diff options
Diffstat (limited to 'spec/frontend/sentry/index_spec.js')
-rw-r--r-- | spec/frontend/sentry/index_spec.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/frontend/sentry/index_spec.js b/spec/frontend/sentry/index_spec.js new file mode 100644 index 00000000000..82b6c445d96 --- /dev/null +++ b/spec/frontend/sentry/index_spec.js @@ -0,0 +1,44 @@ +import SentryConfig from '~/sentry/sentry_config'; +import index from '~/sentry/index'; + +describe('SentryConfig options', () => { + const dsn = 'https://123@sentry.gitlab.test/123'; + const currentUserId = 'currentUserId'; + const gitlabUrl = 'gitlabUrl'; + const environment = 'test'; + const revision = 'revision'; + let indexReturnValue; + + beforeEach(() => { + window.gon = { + sentry_dsn: dsn, + sentry_environment: environment, + current_user_id: currentUserId, + gitlab_url: gitlabUrl, + revision, + }; + + process.env.HEAD_COMMIT_SHA = revision; + + jest.spyOn(SentryConfig, 'init').mockImplementation(); + + indexReturnValue = index(); + }); + + it('should init with .sentryDsn, .currentUserId, .whitelistUrls and environment', () => { + expect(SentryConfig.init).toHaveBeenCalledWith({ + dsn, + currentUserId, + whitelistUrls: [gitlabUrl, 'webpack-internal://'], + environment, + release: revision, + tags: { + revision, + }, + }); + }); + + it('should return SentryConfig', () => { + expect(indexReturnValue).toBe(SentryConfig); + }); +}); |