Skip to content

Commit

Permalink
Merge pull request #271 from vgrigoruk/fix/boolean_matcher
Browse files Browse the repository at this point in the history
fix(matchers): remove hardcoded true value from a boolean matcher
  • Loading branch information
mefellows authored Feb 21, 2019
2 parents 58537d4 + 499c02c commit 6acc1d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/dsl/matchers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,15 @@ describe("Matcher", () => {
describe("when used it should create a JSON object", () => {
it("should not fail", () => {
expect(boolean()).to.be.an("object")
expect(boolean().contents).to.equal(true)
})
it("should not fail with value=false", () => {
expect(boolean(false)).to.be.an("object")
expect(boolean(false).contents).to.equal(false)
})
it("should not fail with value=true", () => {
expect(boolean(true)).to.be.an("object")
expect(boolean(true).contents).to.equal(true)
})
})
})
Expand Down
4 changes: 2 additions & 2 deletions src/dsl/matchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ export function integer(int?: number) {
/**
* Boolean Matcher.
*/
export function boolean() {
return somethingLike<boolean>(true)
export function boolean(value: boolean = true) {
return somethingLike<boolean>(value)
}

// Convenience alias'
Expand Down

0 comments on commit 6acc1d8

Please sign in to comment.