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