Browse Source

chore: Colocate all remaining frontend tests (#38352)

An outcome from Frontend TSC, we're co-locating
tests to make them more discoverable, have them as
references to learn about the module/components
and better visibility into what is being tested. [This](https://github.com/getsentry/sentry/pull/37618/files)
change should ensure tests under the test/ folder
as well as colocated tests get run in CI as we move
files over in batches.

This PR also rebalances the jest tests.

(PR 9/9!!!!)
Previous PRs:
https://github.com/getsentry/sentry/pull/38234
https://github.com/getsentry/sentry/pull/38235
https://github.com/getsentry/sentry/pull/38240
https://github.com/getsentry/sentry/pull/38248
https://github.com/getsentry/sentry/pull/38251
https://github.com/getsentry/sentry/pull/38260
https://github.com/getsentry/sentry/pull/38306
https://github.com/getsentry/sentry/pull/38339
Shruthi 2 years ago
parent
commit
b089084d41

+ 0 - 0
tests/js/spec/api.spec.tsx → static/app/api.spec.tsx


+ 0 - 0
tests/js/spec/bootstrap/processInitQueue.spec.jsx → static/app/bootstrap/processInitQueue.spec.jsx


+ 0 - 0
tests/js/spec/bootstrap/renderOnDomReady.spec.jsx → static/app/bootstrap/renderOnDomReady.spec.jsx


+ 32 - 1
static/app/components/events/interfaces/spans/utils.spec.tsx

@@ -1,4 +1,7 @@
-import {getFormattedTimeRangeWithLeadingZero} from './utils';
+import {
+  getCumulativeAlertLevelFromErrors,
+  getFormattedTimeRangeWithLeadingZero,
+} from 'sentry/components/events/interfaces/spans/utils';
 
 describe('test utility functions', function () {
   it('getFormattedTimeRangeWithLeadingZero', function () {
@@ -23,3 +26,31 @@ describe('test utility functions', function () {
     expect(result.end).toEqual('1658925888.601935');
   });
 });
+
+describe('getCumulativeAlertLevelFromErrors', () => {
+  it('returns undefined for an empty array', () => {
+    expect(getCumulativeAlertLevelFromErrors([])).toBeUndefined();
+  });
+
+  it('returns the alert level of the first error if only one error is provided', () => {
+    expect(getCumulativeAlertLevelFromErrors([{level: 'error'}])).toBe('error');
+  });
+
+  it('returns the highest alert level for a set of severe errors', () => {
+    expect(getCumulativeAlertLevelFromErrors([{level: 'fatal'}, {level: 'info'}])).toBe(
+      'error'
+    );
+  });
+
+  it('returns the highest alert level for a set of non-severe errors', () => {
+    expect(getCumulativeAlertLevelFromErrors([{level: 'warning'}, {level: 'info'}])).toBe(
+      'warning'
+    );
+  });
+
+  it('returns the highest alert level for a set of info errors', () => {
+    expect(getCumulativeAlertLevelFromErrors([{level: 'info'}, {level: 'info'}])).toBe(
+      'info'
+    );
+  });
+});

+ 0 - 0
tests/js/spec/components/sidebar/sidebarDrodown/index.spec.jsx → static/app/components/sidebar/sidebarDropdown/index.spec.jsx


+ 0 - 0
tests/js/spec/helpers/formatters.spec.jsx → static/app/utils/formatters.spec.jsx


+ 0 - 0
tests/js/spec/views/acceptOrganizationInvite.spec.jsx → static/app/views/acceptOrganizationInvite.spec.jsx


+ 0 - 0
tests/js/spec/views/acceptProjectTransfer.spec.jsx → static/app/views/acceptProjectTransfer.spec.jsx


+ 0 - 0
tests/js/spec/views/admin/adminBuffer.spec.jsx → static/app/views/admin/adminBuffer.spec.jsx


+ 0 - 0
tests/js/spec/views/admin/adminQueue.spec.jsx → static/app/views/admin/adminQueue.spec.jsx


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