32 lines
727 B
TypeScript

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