extendNOPs() function
Add additional NOOPs to expect().
Signature:
declare function extendNOPs(methods: ReadonlyArray<string>): void;
Parameters
Parameter | Type | Description |
---|---|---|
methods | ReadonlyArray<string> | An array of property names to use as NOOPs |
Returns:
void
Remarks
A NOOP is a property that does nothing. It's just there to make the test easier to read.
For example:
expect("Daymon").to.have.the.substring("Day");
In this case, to
, have
, and the
are all NOOPs.
Example
// augment the expect module so typescript knows the properties exists
declare module "@rbxts/expect" {
interface Assertion<T> {
readonly to: this;
readonly have: this;
readonly the: this;
}
}
// add the properties to expect for runtime usage
extendNOPs(["to", "have", "the"]);