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-04-13 16:17:41 +00:00
|
|
|
let sentryDsn;
|
|
|
|
let currentUserId;
|
|
|
|
let gitlabUrl;
|
|
|
|
let isProduction;
|
|
|
|
let indexReturnValue;
|
2017-04-04 13:58:45 +00:00
|
|
|
|
2017-04-13 16:17:41 +00:00
|
|
|
beforeEach(() => {
|
|
|
|
sentryDsn = 'sentryDsn';
|
|
|
|
currentUserId = 'currentUserId';
|
|
|
|
gitlabUrl = 'gitlabUrl';
|
|
|
|
isProduction = 'isProduction';
|
2017-04-04 13:58:45 +00:00
|
|
|
|
2017-04-13 16:17:41 +00:00
|
|
|
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-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,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return RavenConfig', () => {
|
|
|
|
expect(indexReturnValue).toBe(RavenConfig);
|
|
|
|
});
|
2017-04-04 13:58:45 +00:00
|
|
|
});
|