|
@@ -1,20 +1,20 @@
|
|
|
-import envUtils from '~/utils/env-utils';
|
|
|
|
|
|
|
+import { toBoolean } from '~/utils/env-utils';
|
|
|
|
|
|
|
|
|
|
|
|
|
describe('env-utils', () => {
|
|
describe('env-utils', () => {
|
|
|
describe('.toBoolean', () => {
|
|
describe('.toBoolean', () => {
|
|
|
|
|
|
|
|
test('should convert to true', () => {
|
|
test('should convert to true', () => {
|
|
|
- expect(envUtils.toBoolean('true')).toBe(true);
|
|
|
|
|
- expect(envUtils.toBoolean('True')).toBe(true);
|
|
|
|
|
- expect(envUtils.toBoolean(1)).toBe(true);
|
|
|
|
|
|
|
+ expect(toBoolean('true')).toBe(true);
|
|
|
|
|
+ expect(toBoolean('True')).toBe(true);
|
|
|
|
|
+ expect(toBoolean(1)).toBe(true);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
test('should convert to false', () => {
|
|
test('should convert to false', () => {
|
|
|
- expect(envUtils.toBoolean(undefined)).toBe(false);
|
|
|
|
|
- expect(envUtils.toBoolean(null)).toBe(false);
|
|
|
|
|
- expect(envUtils.toBoolean('false')).toBe(false);
|
|
|
|
|
- expect(envUtils.toBoolean(0)).toBe(false);
|
|
|
|
|
|
|
+ expect(toBoolean(undefined)).toBe(false);
|
|
|
|
|
+ expect(toBoolean(null)).toBe(false);
|
|
|
|
|
+ expect(toBoolean('false')).toBe(false);
|
|
|
|
|
+ expect(toBoolean(0)).toBe(false);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
});
|
|
});
|