fix(assertion-matchers): Refactor matcher implementations to consistently use customAssertion for improved consistency and clarity.

This commit is contained in:
2025-04-28 19:58:32 +00:00
parent 4eac4544a5
commit 91a3dc43d3
11 changed files with 265 additions and 43 deletions

View File

@ -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`
);
}
}