feat(core): Add new matchers and improve negation messaging
This commit is contained in:
14
ts/index.ts
14
ts/index.ts
@ -1,4 +1,4 @@
|
||||
import { Assertion } from './smartexpect.classes.assertion.js';
|
||||
import { Assertion, AnyMatcher, AnythingMatcher } from './smartexpect.classes.assertion.js';
|
||||
// import type { TMatcher } from './smartexpect.classes.assertion.js'; // unused
|
||||
|
||||
/**
|
||||
@ -24,6 +24,18 @@ export function expect<T>(value: any): Assertion<T> {
|
||||
*/
|
||||
export namespace expect {
|
||||
export const extend = Assertion.extend;
|
||||
/**
|
||||
* Matcher for a specific constructor. Passes if value is instance of given constructor.
|
||||
*/
|
||||
export function any(constructor: any) {
|
||||
return new AnyMatcher(constructor);
|
||||
}
|
||||
/**
|
||||
* Matcher for any defined value (not null or undefined).
|
||||
*/
|
||||
export function anything() {
|
||||
return new AnythingMatcher();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user