BigW Consortium Gitlab

index_spec.js 966 Bytes
Newer Older
1 2
import RavenConfig from '~/raven/raven_config';
import index from '~/raven/index';
3

Luke "Jared" Bennett committed
4
describe('RavenConfig options', () => {
5 6 7 8 9
  let sentryDsn;
  let currentUserId;
  let gitlabUrl;
  let isProduction;
  let indexReturnValue;
10

11 12 13 14 15
  beforeEach(() => {
    sentryDsn = 'sentryDsn';
    currentUserId = 'currentUserId';
    gitlabUrl = 'gitlabUrl';
    isProduction = 'isProduction';
16

17 18 19 20 21
    window.gon = {
      sentry_dsn: sentryDsn,
      current_user_id: currentUserId,
      gitlab_url: gitlabUrl,
    };
22

Luke "Jared" Bennett committed
23 24
    process.env.NODE_ENV = isProduction;

Luke "Jared" Bennett committed
25
    spyOn(RavenConfig, 'init');
26 27 28 29 30

    indexReturnValue = index();
  });

  it('should init with .sentryDsn, .currentUserId, .whitelistUrls and .isProduction', () => {
Luke "Jared" Bennett committed
31
    expect(RavenConfig.init).toHaveBeenCalledWith({
32 33 34 35 36 37 38 39 40 41
      sentryDsn,
      currentUserId,
      whitelistUrls: [gitlabUrl],
      isProduction,
    });
  });

  it('should return RavenConfig', () => {
    expect(indexReturnValue).toBe(RavenConfig);
  });
42
});