Skip to content

Commit 499c02c

Browse files
author
Vitalii Grygoruk
committed
fix(matchers): remove hardcoded true value from a boolean matcher
1 parent 58537d4 commit 499c02c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/dsl/matchers.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,15 @@ describe("Matcher", () => {
442442
describe("when used it should create a JSON object", () => {
443443
it("should not fail", () => {
444444
expect(boolean()).to.be.an("object")
445+
expect(boolean().contents).to.equal(true)
446+
})
447+
it("should not fail with value=false", () => {
448+
expect(boolean(false)).to.be.an("object")
449+
expect(boolean(false).contents).to.equal(false)
450+
})
451+
it("should not fail with value=true", () => {
452+
expect(boolean(true)).to.be.an("object")
453+
expect(boolean(true).contents).to.equal(true)
445454
})
446455
})
447456
})

src/dsl/matchers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ export function integer(int?: number) {
248248
/**
249249
* Boolean Matcher.
250250
*/
251-
export function boolean() {
252-
return somethingLike<boolean>(true)
251+
export function boolean(value: boolean = true) {
252+
return somethingLike<boolean>(value)
253253
}
254254

255255
// Convenience alias'

0 commit comments

Comments
 (0)