debian-mirror-gitlab/spec/frontend/sentry/index_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-12-26 22:10:19 +05:30
import index from '~/sentry/index';
2021-03-11 19:13:27 +05:30
import SentryConfig from '~/sentry/sentry_config';
2017-08-17 22:00:37 +05:30
2019-12-26 22:10:19 +05:30
describe('SentryConfig options', () => {
const dsn = 'https://123@sentry.gitlab.test/123';
2017-08-17 22:00:37 +05:30
const currentUserId = 'currentUserId';
const gitlabUrl = 'gitlabUrl';
2019-07-31 22:56:46 +05:30
const environment = 'test';
2017-08-17 22:00:37 +05:30
const revision = 'revision';
2021-09-30 23:02:18 +05:30
const featureCategory = 'my_feature_category';
2017-08-17 22:00:37 +05:30
let indexReturnValue;
beforeEach(() => {
window.gon = {
2019-12-26 22:10:19 +05:30
sentry_dsn: dsn,
2019-07-31 22:56:46 +05:30
sentry_environment: environment,
2017-08-17 22:00:37 +05:30
current_user_id: currentUserId,
gitlab_url: gitlabUrl,
revision,
2021-09-30 23:02:18 +05:30
feature_category: featureCategory,
2017-08-17 22:00:37 +05:30
};
process.env.HEAD_COMMIT_SHA = revision;
2019-12-26 22:10:19 +05:30
jest.spyOn(SentryConfig, 'init').mockImplementation();
2017-08-17 22:00:37 +05:30
indexReturnValue = index();
});
2019-07-31 22:56:46 +05:30
it('should init with .sentryDsn, .currentUserId, .whitelistUrls and environment', () => {
2019-12-26 22:10:19 +05:30
expect(SentryConfig.init).toHaveBeenCalledWith({
dsn,
2017-08-17 22:00:37 +05:30
currentUserId,
2019-07-31 22:56:46 +05:30
whitelistUrls: [gitlabUrl, 'webpack-internal://'],
environment,
2017-08-17 22:00:37 +05:30
release: revision,
tags: {
revision,
2021-09-30 23:02:18 +05:30
feature_category: featureCategory,
2017-08-17 22:00:37 +05:30
},
});
});
2019-12-26 22:10:19 +05:30
it('should return SentryConfig', () => {
expect(indexReturnValue).toBe(SentryConfig);
2017-08-17 22:00:37 +05:30
});
});