From 598c5ad18a254314bdd3b19a7fcd29331d9bf5d9 Mon Sep 17 00:00:00 2001 From: Aleksey Kuznetsov Date: Wed, 24 Jul 2024 14:57:40 +0300 Subject: [PATCH] feat: add test for yes/no values for bool validator --- tests/validators.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/validators.test.ts b/tests/validators.test.ts index 2787d08..94c2d0d 100644 --- a/tests/validators.test.ts +++ b/tests/validators.test.ts @@ -28,6 +28,11 @@ test('bool() works with various formats', () => { const f = cleanEnv({ FOO: 'f' }, { FOO: bool() }) expect(f).toEqual({ FOO: false }) + const yes = cleanEnv({ FOO: 'yes'}, { FOO: bool() }) + expect(yes).toEqual({ FOO: true }) + const no = cleanEnv({ FOO: 'no' }, { FOO: bool() }) + expect(no).toEqual({ FOO: false }) + const defaultF = cleanEnv({}, { FOO: bool({ default: false }) }) expect(defaultF).toEqual({ FOO: false }) })