2017-04-13 16:17:41 +00:00
|
|
|
import RavenConfig from '~/raven/raven_config';
|
|
|
|
import index from '~/raven/index';
|
2017-04-04 13:58:45 +00:00
|
|
|
|
2017-04-14 20:09:16 +00:00
|
|
|
describe('RavenConfig options', () => {
|
2017-05-19 20:13:57 +00:00
|
|
|
const sentryDsn = 'sentryDsn';
|
|
|
|
const currentUserId = 'currentUserId';
|
|
|
|
const gitlabUrl = 'gitlabUrl';
|
2019-04-07 19:21:52 +00:00
|
|
|
const environment = 'test';
|
2017-05-21 12:38:03 +00:00
|
|
|
const revision = 'revision';
|
2017-04-13 16:17:41 +00:00
|
|
|
let indexReturnValue;
|
2017-04-04 13:58:45 +00:00
|
|
|
|
2017-04-13 16:17:41 +00:00
|
|
|
beforeEach(() => {
|
|
|
|
window.gon = {
|
|
|
|
sentry_dsn: sentryDsn,
|
2019-04-07 19:21:52 +00:00
|
|
|
sentry_environment: environment,
|
2017-04-13 16:17:41 +00:00
|
|
|
current_user_id: currentUserId,
|
|
|
|
gitlab_url: gitlabUrl,
|
2017-05-21 12:38:03 +00:00
|
|
|
revision,
|
2017-04-13 16:17:41 +00:00
|
|
|
};
|
2017-04-04 13:58:45 +00:00
|
|
|
|
2017-05-21 12:38:03 +00:00
|
|
|
process.env.HEAD_COMMIT_SHA = revision;
|
2017-05-05 14:55:55 +00:00
|
|
|
|
2017-04-14 20:09:16 +00:00
|
|
|
spyOn(RavenConfig, 'init');
|
2017-04-13 16:17:41 +00:00
|
|
|
|
|
|
|
indexReturnValue = index();
|
|
|
|
});
|
|
|
|
|
2019-04-07 19:21:52 +00:00
|
|
|
it('should init with .sentryDsn, .currentUserId, .whitelistUrls and environment', () => {
|
2017-04-14 20:09:16 +00:00
|
|
|
expect(RavenConfig.init).toHaveBeenCalledWith({
|
2017-04-13 16:17:41 +00:00
|
|
|
sentryDsn,
|
|
|
|
currentUserId,
|
2019-04-07 19:21:52 +00:00
|
|
|
whitelistUrls: [gitlabUrl, 'webpack-internal://'],
|
|
|
|
environment,
|
2017-05-21 12:38:03 +00:00
|
|
|
release: revision,
|
2017-05-19 20:13:57 +00:00
|
|
|
tags: {
|
2017-05-21 12:38:03 +00:00
|
|
|
revision,
|
2017-05-19 20:13:57 +00:00
|
|
|
},
|
2017-04-13 16:17:41 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return RavenConfig', () => {
|
|
|
|
expect(indexReturnValue).toBe(RavenConfig);
|
|
|
|
});
|
2017-04-04 13:58:45 +00:00
|
|
|
});
|