Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
chore: added some tests around allowNo
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Oct 17, 2018
1 parent 3e5dd46 commit 9ae52c0
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,4 +521,31 @@ See more help with --help`)
}).to.throw('--bar= cannot also be provided when using --foo=')
})
})

describe('allowNo', () => {
it('is undefined if not set', () => {
const out = parse([], {
flags: {
foo: flags.boolean({allowNo: true}),
},
})
expect(out.flags.foo).to.equal(undefined)
})
it('is false', () => {
const out = parse(['--no-foo'], {
flags: {
foo: flags.boolean({allowNo: true}),
},
})
expect(out.flags.foo).to.equal(false)
})
it('is true', () => {
const out = parse(['--foo'], {
flags: {
foo: flags.boolean({allowNo: true}),
},
})
expect(out.flags.foo).to.equal(true)
})
})
})

0 comments on commit 9ae52c0

Please sign in to comment.