gitlab-org--gitlab-foss/spec/javascripts/raven/index_spec.js

44 lines
1.1 KiB
JavaScript
Raw Normal View History

import RavenConfig from '~/raven/raven_config';
import index from '~/raven/index';
2017-04-14 20:09:16 +00:00
describe('RavenConfig options', () => {
const sentryDsn = 'sentryDsn';
const currentUserId = 'currentUserId';
const gitlabUrl = 'gitlabUrl';
const isProduction = 'isProduction';
const headCommitSHA = 'headCommitSHA';
let indexReturnValue;
beforeEach(() => {
window.gon = {
sentry_dsn: sentryDsn,
current_user_id: currentUserId,
gitlab_url: gitlabUrl,
};
2017-05-05 14:55:55 +00:00
process.env.NODE_ENV = isProduction;
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');
indexReturnValue = index();
});
it('should init with .sentryDsn, .currentUserId, .whitelistUrls and .isProduction', () => {
2017-04-14 20:09:16 +00:00
expect(RavenConfig.init).toHaveBeenCalledWith({
sentryDsn,
currentUserId,
whitelistUrls: [gitlabUrl],
isProduction,
release: headCommitSHA,
tags: {
HEAD_COMMIT_SHA: headCommitSHA,
},
});
});
it('should return RavenConfig', () => {
expect(indexReturnValue).toBe(RavenConfig);
});
});