2017-04-13 12:17:41 -04:00
|
|
|
import RavenConfig from '~/raven/raven_config';
|
|
|
|
import index from '~/raven/index';
|
2017-04-04 09:58:45 -04:00
|
|
|
|
2017-04-14 16:09:16 -04:00
|
|
|
describe('RavenConfig options', () => {
|
2017-05-19 16:13:57 -04:00
|
|
|
const sentryDsn = 'sentryDsn';
|
|
|
|
const currentUserId = 'currentUserId';
|
|
|
|
const gitlabUrl = 'gitlabUrl';
|
|
|
|
const isProduction = 'isProduction';
|
2017-05-21 08:38:03 -04:00
|
|
|
const revision = 'revision';
|
2017-04-13 12:17:41 -04:00
|
|
|
let indexReturnValue;
|
2017-04-04 09:58:45 -04:00
|
|
|
|
2017-04-13 12:17:41 -04:00
|
|
|
beforeEach(() => {
|
|
|
|
window.gon = {
|
|
|
|
sentry_dsn: sentryDsn,
|
|
|
|
current_user_id: currentUserId,
|
|
|
|
gitlab_url: gitlabUrl,
|
2017-05-21 08:38:03 -04:00
|
|
|
revision,
|
2017-04-13 12:17:41 -04:00
|
|
|
};
|
2017-04-04 09:58:45 -04:00
|
|
|
|
2017-05-05 10:55:55 -04:00
|
|
|
process.env.NODE_ENV = isProduction;
|
2017-05-21 08:38:03 -04:00
|
|
|
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');
|
2017-04-13 12:17:41 -04:00
|
|
|
|
|
|
|
indexReturnValue = index();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should init with .sentryDsn, .currentUserId, .whitelistUrls and .isProduction', () => {
|
2017-04-14 16:09:16 -04:00
|
|
|
expect(RavenConfig.init).toHaveBeenCalledWith({
|
2017-04-13 12:17:41 -04:00
|
|
|
sentryDsn,
|
|
|
|
currentUserId,
|
|
|
|
whitelistUrls: [gitlabUrl],
|
|
|
|
isProduction,
|
2017-05-21 08:38:03 -04:00
|
|
|
release: revision,
|
2017-05-19 16:13:57 -04:00
|
|
|
tags: {
|
2017-05-21 08:38:03 -04:00
|
|
|
revision,
|
2017-05-19 16:13:57 -04:00
|
|
|
},
|
2017-04-13 12:17:41 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return RavenConfig', () => {
|
|
|
|
expect(indexReturnValue).toBe(RavenConfig);
|
|
|
|
});
|
2017-04-04 09:58:45 -04:00
|
|
|
});
|