From 2d2c5cf03fd0d872295b4afc7729ebbd7a7f181c Mon Sep 17 00:00:00 2001 From: Evan Purkhiser Date: Wed, 3 Nov 2021 17:51:00 -0700 Subject: [PATCH] test(js): Normalize fixtures - Always export function - Always `.js` - Always `function` over `=>` - Some prettier --- .../{apiApplication.jsx => apiApplication.js} | 0 tests/fixtures/js-stubs/asana.js | 9 ++- .../{authenticators.jsx => authenticators.js} | 0 tests/fixtures/js-stubs/broadcast.js | 3 +- .../js-stubs/dataScrubbingRelayPiiConfig.js | 14 +++++ .../js-stubs/dataScrubbingRelayPiiConfig.tsx | 16 ----- ...ptionWithMeta.jsx => exceptionWithMeta.js} | 4 +- ...cidentActivity.jsx => incidentActivity.js} | 0 .../js-stubs/incidentSuspectCommit.js | 0 .../js-stubs/organizationIntegrations.js | 60 ++++++++++--------- tests/fixtures/js-stubs/phabricator.js | 8 +-- tests/fixtures/js-stubs/projectKeys.js | 3 +- ...pdateSdkAndEnableIntegrationSuggestion.js} | 0 tests/fixtures/js-stubs/vsts-old.js | 6 +- 14 files changed, 57 insertions(+), 66 deletions(-) rename tests/fixtures/js-stubs/{apiApplication.jsx => apiApplication.js} (100%) rename tests/fixtures/js-stubs/{authenticators.jsx => authenticators.js} (100%) create mode 100644 tests/fixtures/js-stubs/dataScrubbingRelayPiiConfig.js delete mode 100644 tests/fixtures/js-stubs/dataScrubbingRelayPiiConfig.tsx rename tests/fixtures/js-stubs/{exceptionWithMeta.jsx => exceptionWithMeta.js} (89%) rename tests/fixtures/js-stubs/{incidentActivity.jsx => incidentActivity.js} (100%) delete mode 100644 tests/fixtures/js-stubs/incidentSuspectCommit.js rename tests/fixtures/js-stubs/{updateSdkAndEnableIntegrationSuggestion.jsx => updateSdkAndEnableIntegrationSuggestion.js} (100%) diff --git a/tests/fixtures/js-stubs/apiApplication.jsx b/tests/fixtures/js-stubs/apiApplication.js similarity index 100% rename from tests/fixtures/js-stubs/apiApplication.jsx rename to tests/fixtures/js-stubs/apiApplication.js diff --git a/tests/fixtures/js-stubs/asana.js b/tests/fixtures/js-stubs/asana.js index 83d49b6598b3ac..56e9d3c438a103 100644 --- a/tests/fixtures/js-stubs/asana.js +++ b/tests/fixtures/js-stubs/asana.js @@ -1,4 +1,4 @@ -function AsanaPlugin() { +export function AsanaPlugin() { return { status: 'unknown', description: 'Integrate Asana issues by linking a repository to a project.', @@ -26,7 +26,7 @@ function AsanaPlugin() { }; } -function AsanaCreate() { +export function AsanaCreate() { return [ { name: 'workspace', @@ -70,8 +70,7 @@ function AsanaCreate() { } const DEFAULT_AUTOCOMPLETE = {text: '(#724210387969378) billy', id: 724210387969378}; -function AsanaAutocomplete(type = 'project', values = [DEFAULT_AUTOCOMPLETE]) { + +export function AsanaAutocomplete(type = 'project', values = [DEFAULT_AUTOCOMPLETE]) { return {[type]: values}; } - -export {AsanaAutocomplete, AsanaCreate, AsanaPlugin}; diff --git a/tests/fixtures/js-stubs/authenticators.jsx b/tests/fixtures/js-stubs/authenticators.js similarity index 100% rename from tests/fixtures/js-stubs/authenticators.jsx rename to tests/fixtures/js-stubs/authenticators.js diff --git a/tests/fixtures/js-stubs/broadcast.js b/tests/fixtures/js-stubs/broadcast.js index bc018edb050f1a..18c9a6ba7f5993 100644 --- a/tests/fixtures/js-stubs/broadcast.js +++ b/tests/fixtures/js-stubs/broadcast.js @@ -5,8 +5,7 @@ export function Broadcast(params = {}) { hasSeen: false, id: '8', isActive: true, - link: - 'https://docs.sentry.io/clients/javascript/sourcemaps/#uploading-source-maps-to-sentry', + link: 'https://docs.sentry.io/clients/javascript/sourcemaps/#uploading-source-maps-to-sentry', message: 'Source maps are JSON files that contain information on how to map your transpiled source code back to their original source.', title: 'Learn about Source Maps', diff --git a/tests/fixtures/js-stubs/dataScrubbingRelayPiiConfig.js b/tests/fixtures/js-stubs/dataScrubbingRelayPiiConfig.js new file mode 100644 index 00000000000000..eca628e23f4291 --- /dev/null +++ b/tests/fixtures/js-stubs/dataScrubbingRelayPiiConfig.js @@ -0,0 +1,14 @@ +export function DataScrubbingRelayPiiConfig() { + return { + rules: { + 0: {type: 'password', redaction: {method: 'replace', text: 'Scrubbed'}}, + 1: {type: 'creditcard', redaction: {method: 'mask'}}, + 2: { + type: 'pattern', + pattern: '[a-zA-Z0-9]+', + redaction: {method: 'replace', text: 'Placeholder'}, + }, + }, + applications: {password: ['0'], $message: ['1', '2']}, + }; +} diff --git a/tests/fixtures/js-stubs/dataScrubbingRelayPiiConfig.tsx b/tests/fixtures/js-stubs/dataScrubbingRelayPiiConfig.tsx deleted file mode 100644 index dcbf824f31ccfa..00000000000000 --- a/tests/fixtures/js-stubs/dataScrubbingRelayPiiConfig.tsx +++ /dev/null @@ -1,16 +0,0 @@ -function DataScrubbingRelayPiiConfig() { - return { - rules: { - '0': {type: 'password', redaction: {method: 'replace', text: 'Scrubbed'}}, - '1': {type: 'creditcard', redaction: {method: 'mask'}}, - '2': { - type: 'pattern', - pattern: '[a-zA-Z0-9]+', - redaction: {method: 'replace', text: 'Placeholder'}, - }, - }, - applications: {password: ['0'], $message: ['1', '2']}, - }; -} - -export {DataScrubbingRelayPiiConfig}; diff --git a/tests/fixtures/js-stubs/exceptionWithMeta.jsx b/tests/fixtures/js-stubs/exceptionWithMeta.js similarity index 89% rename from tests/fixtures/js-stubs/exceptionWithMeta.jsx rename to tests/fixtures/js-stubs/exceptionWithMeta.js index e4942520ecf3fc..3a18c0cd49f6be 100644 --- a/tests/fixtures/js-stubs/exceptionWithMeta.jsx +++ b/tests/fixtures/js-stubs/exceptionWithMeta.js @@ -1,4 +1,4 @@ -function ExceptionWithMeta(props = {}) { +export function ExceptionWithMeta(props = {}) { return { level: 'error', platform: 'python', @@ -31,5 +31,3 @@ function ExceptionWithMeta(props = {}) { ...props, }; } - -export {ExceptionWithMeta}; diff --git a/tests/fixtures/js-stubs/incidentActivity.jsx b/tests/fixtures/js-stubs/incidentActivity.js similarity index 100% rename from tests/fixtures/js-stubs/incidentActivity.jsx rename to tests/fixtures/js-stubs/incidentActivity.js diff --git a/tests/fixtures/js-stubs/incidentSuspectCommit.js b/tests/fixtures/js-stubs/incidentSuspectCommit.js deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/tests/fixtures/js-stubs/organizationIntegrations.js b/tests/fixtures/js-stubs/organizationIntegrations.js index 353a54202861ac..9384bed4111aba 100644 --- a/tests/fixtures/js-stubs/organizationIntegrations.js +++ b/tests/fixtures/js-stubs/organizationIntegrations.js @@ -1,30 +1,32 @@ -export const OrganizationIntegrations = organizationId => ({ - id: '15', - name: 'hb-testing', - icon: 'https://a.slack-edge.com/80588/img/avatars-teams/ava_0012-132.png', - domainName: 'hb-testing.slack.com', - accountType: null, - status: 'active', - provider: { - key: 'slack', - slug: 'slack', - name: 'Slack', - canAdd: true, - canDisable: false, - features: ['alert-rule', 'chat-unfurl'], - aspects: { - alerts: [ - { - type: 'info', - text: 'The Slack integration adds a new Alert Rule action to all projects. To enable automatic notifications sent to Slack you must create a rule using the slack workspace action in your project settings.', - }, - ], +export function OrganizationIntegrations(organizationId) { + return { + id: '15', + name: 'hb-testing', + icon: 'https://a.slack-edge.com/80588/img/avatars-teams/ava_0012-132.png', + domainName: 'hb-testing.slack.com', + accountType: null, + status: 'active', + provider: { + key: 'slack', + slug: 'slack', + name: 'Slack', + canAdd: true, + canDisable: false, + features: ['alert-rule', 'chat-unfurl'], + aspects: { + alerts: [ + { + type: 'info', + text: 'The Slack integration adds a new Alert Rule action to all projects. To enable automatic notifications sent to Slack you must create a rule using the slack workspace action in your project settings.', + }, + ], + }, }, - }, - configOrganization: [], - configData: { - installationType: 'born_as_bot', - }, - organizationId, - externalId: 'TA99AB9CD', -}); + configOrganization: [], + configData: { + installationType: 'born_as_bot', + }, + organizationId, + externalId: 'TA99AB9CD', + }; +} diff --git a/tests/fixtures/js-stubs/phabricator.js b/tests/fixtures/js-stubs/phabricator.js index 0b32558e3ce802..51183ff09cab46 100644 --- a/tests/fixtures/js-stubs/phabricator.js +++ b/tests/fixtures/js-stubs/phabricator.js @@ -1,4 +1,4 @@ -function PhabricatorPlugin() { +export function PhabricatorPlugin() { return { status: 'unknown', description: @@ -35,7 +35,7 @@ function PhabricatorPlugin() { }; } -function PhabricatorCreate() { +export function PhabricatorCreate() { return [ { default: 'ApiException: Authentication failed, token expired!', @@ -79,7 +79,7 @@ const DEFAULT_AUTOCOMPLETE_ASSIGNEE = { const DEFAULT_AUTOCOMPLETE_TAG1 = {text: 'Bar', id: 'PHID-PROJ-biz3qujawd2dfknvhpqv'}; const DEFAULT_AUTOCOMPLETE_TAG2 = {text: 'Foo', id: 'PHID-PROJ-3dfrsmwmavdv4gbg4fxd'}; -function PhabricatorAutocomplete(type = 'project', values = null) { +export function PhabricatorAutocomplete(type = 'project', values = null) { if (values) { return {[type]: values}; } @@ -91,5 +91,3 @@ function PhabricatorAutocomplete(type = 'project', values = null) { } return {[type]: values}; } - -export {PhabricatorAutocomplete, PhabricatorCreate, PhabricatorPlugin}; diff --git a/tests/fixtures/js-stubs/projectKeys.js b/tests/fixtures/js-stubs/projectKeys.js index 1042f22a1589c2..1d35564e2134c4 100644 --- a/tests/fixtures/js-stubs/projectKeys.js +++ b/tests/fixtures/js-stubs/projectKeys.js @@ -7,8 +7,7 @@ export function ProjectKeys(params = []) { minidump: 'http://dev.getsentry.net:8000/api/1/minidump?sentry_key=188ee45a58094d939428d8585aa6f661', public: 'http://188ee45a58094d939428d8585aa6f661@dev.getsentry.net:8000/1', - csp: - 'http://dev.getsentry.net:8000/api/1/csp-report/?sentry_key=188ee45a58094d939428d8585aa6f661', + csp: 'http://dev.getsentry.net:8000/api/1/csp-report/?sentry_key=188ee45a58094d939428d8585aa6f661', security: 'http://dev.getsentry.net:8000/api/1/security-report/?sentry_key=188ee45a58094d939428d8585aa6f661', }, diff --git a/tests/fixtures/js-stubs/updateSdkAndEnableIntegrationSuggestion.jsx b/tests/fixtures/js-stubs/updateSdkAndEnableIntegrationSuggestion.js similarity index 100% rename from tests/fixtures/js-stubs/updateSdkAndEnableIntegrationSuggestion.jsx rename to tests/fixtures/js-stubs/updateSdkAndEnableIntegrationSuggestion.js diff --git a/tests/fixtures/js-stubs/vsts-old.js b/tests/fixtures/js-stubs/vsts-old.js index 90dd5b3f4298be..7730d346dd73a0 100644 --- a/tests/fixtures/js-stubs/vsts-old.js +++ b/tests/fixtures/js-stubs/vsts-old.js @@ -1,4 +1,4 @@ -function VstsPlugin() { +export function VstsPlugin() { return { status: 'unknown', description: 'Integrate Visual Studio Team Services work items by linking a project.', @@ -26,7 +26,7 @@ function VstsPlugin() { }; } -function VstsCreate() { +export function VstsCreate() { return [ { name: 'project', @@ -51,5 +51,3 @@ function VstsCreate() { }, ]; } - -export {VstsCreate, VstsPlugin};