Repository URL to install this package:
|
Version:
0.5.2-rc.0 ▾
|
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);
});
});
});