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:
32
ts/namespaces/string.ts
Normal file
32
ts/namespaces/string.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import { Assertion } from '../smartexpect.classes.assertion.js';
|
||||
|
||||
/**
|
||||
* Namespace for string-specific matchers
|
||||
*/
|
||||
export class StringMatchers {
|
||||
constructor(private assertion: Assertion<string>) {}
|
||||
|
||||
toStartWith(prefix: string) {
|
||||
return this.assertion.toStartWith(prefix);
|
||||
}
|
||||
|
||||
toEndWith(suffix: string) {
|
||||
return this.assertion.toEndWith(suffix);
|
||||
}
|
||||
|
||||
toInclude(substring: string) {
|
||||
return this.assertion.toInclude(substring);
|
||||
}
|
||||
|
||||
toMatch(regex: RegExp) {
|
||||
return this.assertion.toMatch(regex);
|
||||
}
|
||||
|
||||
toBeOneOf(values: string[]) {
|
||||
return this.assertion.toBeOneOf(values);
|
||||
}
|
||||
/** Length check for strings */
|
||||
toHaveLength(length: number) {
|
||||
return this.assertion.toHaveLength(length);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user