@whook/whook
Version:
Build strong and efficient REST web services.
26 lines (23 loc) • 913 B
text/typescript
import { describe, test, expect } from '@jest/globals';
import { checkEnvironment } from './environments.js';
describe('checkEnvironment', () => {
describe('should return true', () => {
test('without environments', () => {
expect(checkEnvironment(undefined, 'test')).toBeTruthy();
});
test('with all environments', () => {
expect(checkEnvironment('all', 'test')).toBeTruthy();
});
test('with the good environment', () => {
expect(checkEnvironment(['test'], 'test')).toBeTruthy();
expect(checkEnvironment(['test', 'local'], 'test')).toBeTruthy();
});
});
describe('should return false', () => {
test('without the good environment', () => {
expect(checkEnvironment([], 'test')).toBeFalsy();
expect(checkEnvironment(['local'], 'test')).toBeFalsy();
expect(checkEnvironment(['local', 'production'], 'test')).toBeFalsy();
});
});
});