Base class for all assertions in the test framework.
Assertions validate conditions during test execution and throw errors when validation fails. They can check context values, HTTP responses, or any other testable conditions.
Subclasses must implement:
type(): Return a string identifier for the assertion typevalidate(): Perform the validation logic (throw on failure)
Example 1
Example 1
class AgePositiveAssertion<Con> extends Assertion<Con> { constructor(private ageKey: string) { super(); } type() { return "AgePositive"; } async validate(extractor: VExtractor<Con>) { const age = extractor.extractSpecificFromContext(this.ageKey); if (age <= 0) { throw new Error("Age must be positive"); } } }
Con extends Record<string, unknown>