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

45 lines
1 KiB
JavaScript
Raw Normal View History

import RavenConfig from '~/raven/raven_config';
import index from '~/raven/index';
2017-04-14 16:09:16 -04:00
describe('RavenConfig options', () => {
const sentryDsn = 'sentryDsn';
const currentUserId = 'currentUserId';
const gitlabUrl = 'gitlabUrl';
const environment = 'test';
const revision = 'revision';
let indexReturnValue;
beforeEach(() => {
window.gon = {
sentry_dsn: sentryDsn,
sentry_environment: environment,
current_user_id: currentUserId,
gitlab_url: gitlabUrl,
revision,
};
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');
indexReturnValue = index();
});
it('should init with .sentryDsn, .currentUserId, .whitelistUrls and environment', () => {
2017-04-14 16:09:16 -04:00
expect(RavenConfig.init).toHaveBeenCalledWith({
sentryDsn,
currentUserId,
whitelistUrls: [gitlabUrl, 'webpack-internal://'],
environment,
release: revision,
tags: {
revision,
},
});
});
it('should return RavenConfig', () => {
expect(indexReturnValue).toBe(RavenConfig);
});
});