env-utils.spec.ts 529 B

123456789101112131415161718
  1. import { toBoolean } from './env-utils';
  2. describe('env-utils', () => {
  3. describe('.toBoolean', () => {
  4. it('should convert to true', () => {
  5. expect(toBoolean('true')).toBe(true);
  6. expect(toBoolean('True')).toBe(true);
  7. expect(toBoolean('1')).toBe(true);
  8. });
  9. it('should convert to false', () => {
  10. // expect(toBoolean(undefined)).toBe(false);
  11. // expect(toBoolean(null)).toBe(false);
  12. expect(toBoolean('false')).toBe(false);
  13. expect(toBoolean('0')).toBe(false);
  14. });
  15. });
  16. });