You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/07/29 07:23:33 UTC

[GitHub] [incubator-superset] suddjian opened a new pull request #10459: Add jest-enzyme assertion library for better frontend tests

suddjian opened a new pull request #10459:
URL: https://github.com/apache/incubator-superset/pull/10459


   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   
   The [jest-enzyme](https://www.npmjs.com/package/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)
   ```
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org