BREAKING CHANGE(docs): Update documentation and examples to unify async and sync assertions, add custom matcher guides, and update package configuration

This commit is contained in:
2025-04-28 19:10:27 +00:00
parent 6f1e37cf56
commit 47458118a6
19 changed files with 606 additions and 663 deletions

44
ts/namespaces/array.ts Normal file
View File

@ -0,0 +1,44 @@
import { Assertion } from '../smartexpect.classes.assertion.js';
/**
* Namespace for array-specific matchers
*/
export class ArrayMatchers<T> {
constructor(private assertion: Assertion<T[]>) {}
toBeArray() {
return this.assertion.toBeArray();
}
toHaveLength(length: number) {
return this.assertion.toHaveLength(length);
}
toContain(item: T) {
return this.assertion.toContain(item);
}
toContainEqual(item: T) {
return this.assertion.toContainEqual(item);
}
toContainAll(items: T[]) {
return this.assertion.toContainAll(items);
}
toExclude(item: T) {
return this.assertion.toExclude(item);
}
toBeEmptyArray() {
return this.assertion.toBeEmptyArray();
}
toHaveLengthGreaterThan(length: number) {
return this.assertion.toHaveLengthGreaterThan(length);
}
toHaveLengthLessThan(length: number) {
return this.assertion.toHaveLengthLessThan(length);
}
}