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

42 lines
959 B
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', () => {
let sentryDsn;
let currentUserId;
let gitlabUrl;
let isProduction;
let indexReturnValue;
beforeEach(() => {
sentryDsn = 'sentryDsn';
currentUserId = 'currentUserId';
gitlabUrl = 'gitlabUrl';
isProduction = 'isProduction';
window.gon = {
sentry_dsn: sentryDsn,
current_user_id: currentUserId,
gitlab_url: gitlabUrl,
is_production: isProduction,
};
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,
});
});
it('should return RavenConfig', () => {
expect(indexReturnValue).toBe(RavenConfig);
});
});