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

test: Add jest-enzyme assertion library for better frontend tests #10459

Merged
merged 3 commits into from
Jul 29, 2020

Conversation

suddjian
Copy link
Member

SUMMARY

The jest-enzyme library adds lots of useful assertions onto jest. This PR improves frontend test readability and adds useful context to failure messages.

An example of a test failure using an enzyme assertion:

FAIL  spec/javascripts/addSlice/AddSliceContainer_spec.tsx (60.221 s)
  ● AddSliceContainer › renders a select and a VizTypeControl

    Expected "Memo(StyledSelect)" not to exist. Instead found 1 nodes.
    Found Nodes: <Memo(StyledSelect) clearable={false} ignoreAccents={false} name="select-datasource" onChange={[Function: bound changeDatasource]} options={{...}} placeholder="Choose a datasource" style={{...}} value={[undefined]} width={600} />

      50 |
      51 |   it('renders a select and a VizTypeControl', () => {
    > 52 |     expect(wrapper.find(Select)).not.toExist();
         |                                      ^
      53 |     expect(wrapper.find(VizTypeControl)).toExist();
      54 |   });
      55 |

      at Object.<anonymous> (spec/javascripts/addSlice/AddSliceContainer_spec.tsx:52:38)

@suddjian suddjian requested review from rusackas and nytai July 28, 2020 23:28
@suddjian suddjian changed the title Add jest-enzyme assertion library for better frontend tests test: Add jest-enzyme assertion library for better frontend tests Jul 28, 2020
Copy link
Member

@nytai nytai left a comment

Choose a reason for hiding this comment

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

lgtm!

@rusackas rusackas merged commit 7f70a24 into apache:master Jul 29, 2020
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
…ache#10459)

* adding jest-enzyme

* enzymeify lots of assertions

* types for jest-enzyme
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.38.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XL 🚢 0.38.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants