Browse Source

fix(test): Fix jest/no-standalone-expect (#33239)

Evan Purkhiser 2 years ago
parent
commit
a5cb91389f

+ 27 - 19
tests/js/spec/components/events/interfaces/crashContent/stackTrace/rawContent.spec.jsx

@@ -39,20 +39,24 @@ describe('RawStacktraceContent', function () {
   });
   });
 
 
   describe('getJavaPreamble()', function () {
   describe('getJavaPreamble()', function () {
-    expect(
-      getJavaPreamble({
-        type: 'Baz',
-        value: 'message',
-      })
-    ).toEqual('Baz: message');
+    it('takes a type and value', () => {
+      expect(
+        getJavaPreamble({
+          type: 'Baz',
+          value: 'message',
+        })
+      ).toEqual('Baz: message');
+    });
 
 
-    expect(
-      getJavaPreamble({
-        module: 'foo.bar',
-        type: 'Baz',
-        value: 'message',
-      })
-    ).toEqual('foo.bar.Baz: message');
+    it('takes a module name', () => {
+      expect(
+        getJavaPreamble({
+          module: 'foo.bar',
+          type: 'Baz',
+          value: 'message',
+        })
+      ).toEqual('foo.bar.Baz: message');
+    });
   });
   });
 
 
   describe('render()', function () {
   describe('render()', function () {
@@ -78,16 +82,20 @@ describe('RawStacktraceContent', function () {
         ],
         ],
       };
       };
 
 
-    expect(render(data, 'java', exception)).toEqual(
-      `example.application.Error: an error occurred
+    it('renders java example', () => {
+      expect(render(data, 'java', exception)).toEqual(
+        `example.application.Error: an error occurred
     at example.application.doThing(application:2)
     at example.application.doThing(application:2)
     at example.application.main(application:1)`
     at example.application.main(application:1)`
-    );
+      );
+    });
 
 
-    expect(render(data, 'python', exception)).toEqual(
-      `Error: an error occurred
+    it('renders python example', () => {
+      expect(render(data, 'python', exception)).toEqual(
+        `Error: an error occurred
   File "application", line 1, in main
   File "application", line 1, in main
   File "application", line 2, in doThing`
   File "application", line 2, in doThing`
-    );
+      );
+    });
   });
   });
 });
 });

+ 8 - 6
tests/js/spec/utils/utils.spec.jsx

@@ -239,12 +239,14 @@ describe('utils.projectDisplayCompare', function () {
 });
 });
 
 
 describe('utils.descopeFeatureName', function () {
 describe('utils.descopeFeatureName', function () {
-  [
-    ['organizations:feature', 'feature'],
-    ['projects:feature', 'feature'],
-    ['unknown-scope:feature', 'unknown-scope:feature'],
-    ['', ''],
-  ].map(([input, expected]) => expect(descopeFeatureName(input)).toEqual(expected));
+  it('descopes the feature name', () => {
+    [
+      ['organizations:feature', 'feature'],
+      ['projects:feature', 'feature'],
+      ['unknown-scope:feature', 'unknown-scope:feature'],
+      ['', ''],
+    ].forEach(([input, expected]) => expect(descopeFeatureName(input)).toEqual(expected));
+  });
 });
 });
 
 
 describe('deepFreeze', function () {
 describe('deepFreeze', function () {