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:
44
ts/namespaces/array.ts
Normal file
44
ts/namespaces/array.ts
Normal 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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user