2017-08-17 22:00:37 +05:30
|
|
|
import RavenConfig from '~/raven/raven_config';
|
|
|
|
import index from '~/raven/index';
|
|
|
|
|
|
|
|
describe('RavenConfig options', () => {
|
|
|
|
const sentryDsn = 'sentryDsn';
|
|
|
|
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';
|
|
|
|
let indexReturnValue;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
window.gon = {
|
|
|
|
sentry_dsn: sentryDsn,
|
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,
|
|
|
|
};
|
|
|
|
|
|
|
|
process.env.HEAD_COMMIT_SHA = revision;
|
|
|
|
|
|
|
|
spyOn(RavenConfig, 'init');
|
|
|
|
|
|
|
|
indexReturnValue = index();
|
|
|
|
});
|
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
it('should init with .sentryDsn, .currentUserId, .whitelistUrls and environment', () => {
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(RavenConfig.init).toHaveBeenCalledWith({
|
|
|
|
sentryDsn,
|
|
|
|
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,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return RavenConfig', () => {
|
|
|
|
expect(indexReturnValue).toBe(RavenConfig);
|
|
|
|
});
|
|
|
|
});
|