UNPKG

@push.rocks/smartexpect

Version:

A testing library to manage expectations in code, offering both synchronous and asynchronous assertion methods.

21 lines (20 loc) 1.12 kB
import { Assertion } from '../smartexpect.classes.assertion.js'; import type { TExecutionType } from '../types.js'; /** * Namespace for string-specific matchers */ export declare class StringMatchers<M extends TExecutionType> { private assertion; constructor(assertion: Assertion<string, M>); toStartWith(prefix: string): M extends "async" ? Promise<Assertion<string, M>> : Assertion<string, M>; toEndWith(suffix: string): M extends "async" ? Promise<Assertion<string, M>> : Assertion<string, M>; toInclude(substring: string): M extends "async" ? Promise<Assertion<string, M>> : Assertion<string, M>; toMatch(regex: RegExp): M extends "async" ? Promise<Assertion<string, M>> : Assertion<string, M>; toBeOneOf(values: string[]): M extends "async" ? Promise<Assertion<string, M>> : Assertion<string, M>; /** Length check for strings */ toHaveLength(length: number): M extends "async" ? Promise<Assertion<string, M>> : Assertion<string, M>; /** * Alias for empty string check */ toBeEmpty(): M extends "async" ? Promise<Assertion<string, M>> : Assertion<string, M>; }