Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@doodle/tracking / src / googleAnalytics / helpers / getSystemType.spec.js
Size: Mime:
import getSystemType, { SystemType } from './getSystemType';

describe('getSystemType', () => {
  it('returns `SystemType.DEVELOPMENT` per default', () => {
    expect(getSystemType({})).toBe(SystemType.DEVELOPMENT);
  });

  it('returns `SystemType.DEVELOPMENT` when NODE_ENV is not `production`', () => {
    const type = getSystemType({ NODE_ENV: 'development', DOODLE_ENV: 'staging' });

    expect(type).toBe(SystemType.DEVELOPMENT);
  });

  describe('when NODE_ENV is `production`', () => {
    it('returns `SystemType.DEVELOPMENT` when DOODLE_ENV is not set', () => {
      const type = getSystemType({ NODE_ENV: 'production' });

      expect(type).toBe(SystemType.DEVELOPMENT);
    });

    it('returns `SystemType.DEVELOPMENT` when DOODLE_ENV is unknown', () => {
      const type = getSystemType({ NODE_ENV: 'production', DOODLE_ENV: 'something weird' });

      expect(type).toBe(SystemType.DEVELOPMENT);
    });

    it('returns `SystemType.STAGING` when DOODLE_ENV is `staging`', () => {
      const type = getSystemType({ NODE_ENV: 'production', DOODLE_ENV: 'staging' });

      expect(type).toBe(SystemType.STAGING);
    });

    it('returns `SystemType.PREPRODUCTION` when DOODLE_ENV is `preproduction`', () => {
      const type = getSystemType({ NODE_ENV: 'production', DOODLE_ENV: 'preproduction' });

      expect(type).toBe(SystemType.PREPRODUCTION);
    });

    it('returns `SystemType.PRODUCTION` when DOODLE_ENV is `production`', () => {
      const type = getSystemType({ NODE_ENV: 'production', DOODLE_ENV: 'production' });

      expect(type).toBe(SystemType.PRODUCTION);
    });
  });
});