Skip to content

Commit

Permalink
feat: add test for yes/no values for bool validator
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksey Kuznetsov committed Jul 24, 2024
1 parent 93f8c56 commit 598c5ad
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/validators.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
})
Expand Down

0 comments on commit 598c5ad

Please sign in to comment.