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';
|
|
|
|
const isProduction = 'isProduction';
|
|
|
|
const headCommitSHA = 'headCommitSHA';
|
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,
|
|
|
|
current_user_id: currentUserId,
|
|
|
|
gitlab_url: gitlabUrl,
|
|
|
|
};
|
2017-04-04 13:58:45 +00:00
|
|
|
|
2017-05-05 14:55:55 +00:00
|
|
|
process.env.NODE_ENV = isProduction;
|
2017-05-19 20:13:57 +00:00
|
|
|
process.env.HEAD_COMMIT_SHA = headCommitSHA;
|
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();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should init with .sentryDsn, .currentUserId, .whitelistUrls and .isProduction', () => {
|
2017-04-14 20:09:16 +00:00
|
|
|
expect(RavenConfig.init).toHaveBeenCalledWith({
|
2017-04-13 16:17:41 +00:00
|
|
|
sentryDsn,
|
|
|
|
currentUserId,
|
|
|
|
whitelistUrls: [gitlabUrl],
|
|
|
|
isProduction,
|
2017-05-19 20:13:57 +00:00
|
|
|
release: headCommitSHA,
|
|
|
|
tags: {
|
|
|
|
HEAD_COMMIT_SHA: headCommitSHA,
|
|
|
|
},
|
2017-04-13 16:17:41 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return RavenConfig', () => {
|
|
|
|
expect(indexReturnValue).toBe(RavenConfig);
|
|
|
|
});
|
2017-04-04 13:58:45 +00:00
|
|
|
});
|