Skip to content

Conversation

@sefonixy
Copy link
Contributor

@sefonixy sefonixy commented Jun 11, 2021

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

sefonixy added 30 commits May 17, 2021 22:59
* 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
@sonarqubecloud
Copy link

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

});

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"

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants