Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test #388

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open

Conversation

YehualashetGit
Copy link
Contributor

@YehualashetGit YehualashetGit commented Jun 11, 2021

add test case for Legend component to include data from context
Screenshot 2021-06-11 at 10 55 23 AM

* loading Map style -> done
* loading ui visibility statut -> WIP
* when we reload the page the style will gone , which needs to be fixed
* add lodash lib to manipulate the object
* add query string param
* make overlay independet Component
@sonarcloud
Copy link

sonarcloud bot commented Jun 11, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.2% 0.2% Duplication

@netlify
Copy link

netlify bot commented Jun 11, 2021

✔️ Deploy Preview for dazzling-visvesvaraya-f47271 ready!

🔨 Explore the source changes: 92e66b2

🔍 Inspect the deploy log: https://app.netlify.com/sites/dazzling-visvesvaraya-f47271/deploys/60c316c27c7b2e0007aa2b13

😎 Browse the preview: https://deploy-preview-388--dazzling-visvesvaraya-f47271.netlify.app

@@ -15,12 +15,15 @@ it('renders correctly when there are no items', () => {
expect(tree).toMatchSnapshot();
});

it('render Correctly with context data' , async () => {
it('>>>render Correctly with context data' , async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do the >>> mean? does it do something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noo it doesn't have any meaning :) lol

// query for element
const element = tree.findByType("div");

expect(element.props.children.length).toEqual(4);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is good start, can we also check if the text or color of the item is "expected"

@@ -15,12 +15,15 @@ it('renders correctly when there are no items', () => {
expect(tree).toMatchSnapshot();
});

it('render Correctly with context data' , async () => {
it('>>>render Correctly with context data' , async () => {
const tree = renderer.create(
<AppContext.Provider value={envMock}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking it might make sense for someone debugging this test in the future, if you edit the envMock right before creating the const tree so that when viewing the test code, it's easy to see what the expected content will be. for example:

let usedEnv = envMock
usedMock.components[1] = {
    "name":"Legend",
    "is_visible": true,
    "data": [
        {
            "title": "mapLegend.no",
            "worldStyle": "2"
        },
}

then you also don't need to keep changing the mock for each test case

@squash-labs
Copy link

squash-labs bot commented Jan 25, 2023

Manage this branch in Squash

Test this branch here: https://unit-test-8zp3j.squash.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants