fix(assertion-matchers): Refactor matcher implementations to consistently use customAssertion for improved consistency and clarity.
This commit is contained in:
@ -7,18 +7,30 @@ export class BooleanMatchers {
|
||||
constructor(private assertion: Assertion<boolean>) {}
|
||||
|
||||
toBeTrue() {
|
||||
return this.assertion.toBeTrue();
|
||||
return this.assertion.customAssertion(
|
||||
(v) => v === true,
|
||||
`Expected value to be true`
|
||||
);
|
||||
}
|
||||
|
||||
toBeFalse() {
|
||||
return this.assertion.toBeFalse();
|
||||
return this.assertion.customAssertion(
|
||||
(v) => v === false,
|
||||
`Expected value to be false`
|
||||
);
|
||||
}
|
||||
|
||||
toBeTruthy() {
|
||||
return this.assertion.toBeTruthy();
|
||||
return this.assertion.customAssertion(
|
||||
(v) => Boolean(v),
|
||||
`Expected value to be truthy`
|
||||
);
|
||||
}
|
||||
|
||||
toBeFalsy() {
|
||||
return this.assertion.toBeFalsy();
|
||||
return this.assertion.customAssertion(
|
||||
(v) => !v,
|
||||
`Expected value to be falsy`
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user