Browse Source

chore(jest): Upgrade jest to 23.4.0 (#8994)

Snapshot changes:
* `UNDEFINED` --> `React.Fragment`
* jest mock fns in snapshots have a `results` object
* `jest.genMockFunction` is removed
* `undefined` props not included in snapshots
Billy Vong 6 years ago
parent
commit
da2c1413d0

+ 1 - 1
package.json

@@ -164,7 +164,7 @@
     "eslint-plugin-import": "^2.7.0",
     "eslint-plugin-jest": "^21.15.0",
     "eslint-plugin-react": "7.4.0",
-    "jest": "22.1.2",
+    "jest": "23.4.0",
     "jest-junit": "^3.4.1",
     "mockdate": "2.0.2",
     "prettier": "1.7.4",

+ 1 - 3
tests/js/spec/components/__snapshots__/shareIssue.spec.jsx.snap

@@ -22,9 +22,7 @@ exports[`ShareIssue renders when busy 1`] = `
         center={true}
         truncate={true}
       >
-        <IndicatorDot
-          active={undefined}
-        />
+        <IndicatorDot />
         Share
       </FlowLayout>
     </div>

+ 3 - 1
tests/js/spec/components/actorAvatar.spec.jsx

@@ -60,7 +60,7 @@ describe('Avatar', function() {
     });
 
     it('should return null when actor type is a unknown', function() {
-      window.console.error = jest.genMockFunction();
+      window.console.error = jest.fn();
 
       let avatar = mount(
         <ActorAvatar
@@ -75,6 +75,8 @@ describe('Avatar', function() {
       expect(avatar.html()).toBe(null);
       //proptype warning
       expect(window.console.error.mock.calls.length).toBeGreaterThan(0);
+
+      window.console.error.mockRestore();
     });
   });
 });

+ 1 - 1
tests/js/spec/utils/retryableImport.spec.jsx

@@ -52,7 +52,7 @@ describe('retryableImport', function() {
 
   it('only retries 3 times', async function() {
     const importMock = jest.fn(
-      () => new Promise((resolve, reject) => reject('Unable to import'))
+      () => new Promise((resolve, reject) => reject(new Error('Unable to import')))
     );
 
     await expect(retryableImport(() => importMock())).rejects.toThrow('Unable to import');

+ 6 - 0
tests/js/spec/views/__snapshots__/ruleBuilder.spec.jsx.snap

@@ -9,6 +9,12 @@ exports[`RuleBuilder renders 1`] = `
           "path:some/path/* janedoe@example.com",
         ],
       ],
+      "results": Array [
+        Object {
+          "isThrow": false,
+          "value": undefined,
+        },
+      ],
     }
   }
   organization={

+ 2 - 2
tests/js/spec/views/onboarding/__snapshots__/createProject.spec.jsx.snap

@@ -4,7 +4,7 @@ exports[`CreateProject should block if you have access to no teams 1`] = `
 <div>
   <Panel
     body={
-      <UNDEFINED>
+      <React.Fragment>
         <PanelAlert
           m={0}
           mb={0}
@@ -22,7 +22,7 @@ exports[`CreateProject should block if you have access to no teams 1`] = `
             Create a Team
           </Button>
         </CreateTeamBody>
-      </UNDEFINED>
+      </React.Fragment>
     }
     title="Cannot Create Project"
   />

+ 12 - 0
tests/js/spec/views/onboarding/__snapshots__/index.spec.jsx.snap

@@ -976,6 +976,12 @@ exports[`OnboardingWizard render() should render and respond to click events 2`]
                   "csharp",
                 ],
               ],
+              "results": Array [
+                Object {
+                  "isThrow": false,
+                  "value": undefined,
+                },
+              ],
             }
           }
           setTeam={[Function]}
@@ -1000,6 +1006,12 @@ exports[`OnboardingWizard render() should render and respond to click events 2`]
                       "csharp",
                     ],
                   ],
+                  "results": Array [
+                    Object {
+                      "isThrow": false,
+                      "value": undefined,
+                    },
+                  ],
                 }
               }
               setTeam={[Function]}

+ 10 - 0
tests/js/spec/views/onboarding/configure/__snapshots__/index.spec.jsx.snap

@@ -146,6 +146,16 @@ exports[`Configure should render correctly render() should render platform docs
                       "/onboarding/testOrg/project-slug/configure/node/",
                     ],
                   ],
+                  "results": Array [
+                    Object {
+                      "isThrow": false,
+                      "value": undefined,
+                    },
+                    Object {
+                      "isThrow": false,
+                      "value": undefined,
+                    },
+                  ],
                 },
                 "go": [MockFunction],
                 "goBack": [MockFunction],

+ 12 - 0
tests/js/spec/views/onboarding/project/__snapshots__/index.spec.jsx.snap

@@ -82,6 +82,12 @@ exports[`Project render() should set required class on empty submit 1`] = `
       "calls": Array [
         Array [],
       ],
+      "results": Array [
+        Object {
+          "isThrow": false,
+          "value": undefined,
+        },
+      ],
     }
   }
   params={
@@ -115,6 +121,12 @@ exports[`Project render() should set required class on empty submit 1`] = `
           "calls": Array [
             Array [],
           ],
+          "results": Array [
+            Object {
+              "isThrow": false,
+              "value": undefined,
+            },
+          ],
         }
       }
       params={

+ 0 - 2
tests/js/spec/views/settings/__snapshots__/organizationApiKeysList.spec.jsx.snap

@@ -46,10 +46,8 @@ exports[`OrganizationApiKeysList renders 1`] = `
     <SettingsPageHeading
       action={
         <Button
-          busy={undefined}
           disabled={false}
           icon="icon-circle-add"
-          onClick={undefined}
           priority="primary"
           size="small"
         >

Some files were not shown because too many files changed in this diff