Assertion interface
Parent interface for all expect() calls.
Signature:
interface Assertion<T = unknown>
Remarks
When a call to expect() is made, the returned value is an instance of this interface.
It provides a common means for all the methods to be attached.
You can think of it as an instance of expect(), or a controller of sorts.
Although, expect() is designed with the idea of call-when-you-need in mind. That is, it's not expected that you'd save the result of an expect() call, and then re-call it at some point down the line.
For example:
// DONT do this
const assertion = expect(5);
assertion.to.be.number();
assertion.to.equal(5);
// Do this
expect(5).to.be.a.number().that.equals(5);
// Or this
const actual = 5;
expect(actual).to.be.a.number();
expect(actual).to.equal(5);
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
| this | NOOP property for cleaner chaining; does nothing. | |
| this | NOOP property for cleaner chaining; does nothing. | |
| this | NOOP property for cleaner chaining; does nothing. | |
| this | NOOP property for cleaner chaining; does nothing. | |
| this | NOOP property for cleaner chaining; does nothing. | |
| this | NOOP property for cleaner chaining; does nothing. | |
| this | NOOP property for cleaner chaining; does nothing. | |
| this | NOOP property for cleaner chaining; does nothing. | |
| this | NOOP property for cleaner chaining; does nothing. | |
Record<number, string> | (Optional) Helper property for getting the mappings for a value that has passed an check. | ||
| this | NOOP property for cleaner chaining; does nothing. | |
boolean | (Optional) Helper property for checking if a value has already passed an check. | ||
| this | NOOP property for cleaner chaining; does nothing. | |
| this | Negates the assertion. | |
| this | Negates the assertion. | |
| this | NOOP property for cleaner chaining; does nothing. | |
| this | NOOP property for cleaner chaining; does nothing. | |
| this | NOOP property for cleaner chaining; does nothing. | |
| this | NOOP property for cleaner chaining; does nothing. | |
| this | NOOP property for cleaner chaining; does nothing. | |
| this | NOOP property for cleaner chaining; does nothing. | |
| T | The "actual" value attached to this expect() call. | |
| this | NOOP property for cleaner chaining; does nothing. |
Methods
Method | Description |
---|---|
Asserts that the value is greater than | |
Asserts that all elements in the array satisfy the specified Filter. | |
Asserts that all elements in the array satisfy the specified Filter. | |
Asserts that the value is shallow equal to any of the provided | |
Asserts that the value is an array. | |
Asserts that the value is an array of type | |
Asserts that the value is an array of type | |
Asserts that the value is an array of type | |
Asserts that the value is an array of type | |
Asserts that the value is an array of type | |
Asserts that the value is an array of type | |
Asserts that the value is less than | |
Asserts that the actual value is a number within a specified range. | |
Asserts that the value is a boolean. | |
Asserts that the actual value is a number within epsilon of | |
Asserts that the actual value is a number within | |
Asserts that the array contains all of the values in | |
Asserts that the array contains all of the values in | |
Asserts that the array contains all of the values in | |
Asserts that the array contains all of the values in | |
Asserts that the value is deep equal to the | |
Asserts that the value is deep equal to the | |
Asserts that the actual value is a non | |
Asserts that the value is empty. | |
Asserts that the array ends with the specified elements. | |
Asserts that the actual value is a string that ends with the specified string. | |
Asserts that the array ends with the specified elements. | |
Asserts that the actual value is a string that ends with the specified string. | |
Asserts that the value is an enum of type | |
Asserts that the value is an enum of type | |
Asserts that the value is an enum of type | |
Asserts that the value is shallow equal to the | |
Asserts that the value is deep equal to the | |
Asserts that the value is deep equal to the | |
Asserts that the value is deep equal to the | |
Asserts that the actual value is an even number. | |
Asserts that the actual value is a non | |
Asserts that the actual value is a non | |
Asserts that the value is a boolean of | |
Asserts that the value is a "falsy" value, according to luau. | |
Asserts that the actual value is a number within | |
Asserts that the value is a function. | |
Asserts that the value is greater than | |
Asserts that the value is greater than or equal to | |
Asserts that the value is greater than | |
Asserts that the value is greater than or equal to | |
Asserts that the | |
Asserts that the | |
Asserts that the value is an instance of type | |
Asserts that the value is an instance of | |
Asserts that the value is an instance of | |
Asserts that the table has the key | |
Asserts that the value is greater than or equal to | |
Asserts that the value has a length of | |
Asserts that the value has a length of | |
Asserts that the value is less than | |
Asserts that the value is less than or equal to | |
Asserts that the value is less than | |
Asserts that the value is less than or equal to | |
Asserts that the actual value has the same properties and values as the | |
Asserts that the actual value has the same properties and values as the | |
Asserts that the value is deep equal to the | |
Asserts that the value is less than or equal to | |
Asserts that the actual value is a number within epsilon of | |
Asserts that the actual value is a number within | |
Asserts that the value is a negative number. | |
Asserts that the actual value is a | |
Asserts that the actual value is a | |
Asserts that the value is a number. | |
Asserts that the value is a table. | |
Asserts that the actual value is an odd number. | |
Asserts that the actual value is a non | |
Asserts that the value is shallow equal to one of the provided | |
Asserts that the | |
Asserts that the value is a positive number. | |
Asserts that the table has the property | |
Asserts that the value returns true for the given | |
Asserts that the value returns true for the given | |
Asserts that the value is shallow equal to the | |
Asserts that the value is shallow equal to the | |
Asserts that the value has a length of | |
Asserts that the value has a length of | |
Asserts that at least one element in the array satisfies the specified Filter. | |
Asserts that at least one element in the array satisfies the specified Filter. | |
Asserts that the array starts with the specified elements. | |
Asserts that the actual value is a string that starts with the specified string. | |
Asserts that the array starts with the specified elements. | |
Asserts that the actual value is a string that starts with the specified string. | |
Asserts that the value is a string. | |
Asserts that the string value contains the string | |
Asserts that the value is a table. | |
Asserts that the function throws an exception. | |
Asserts that the function throws an exception that contains the string | |
Asserts that the function throws an exception that matches the lua pattern | |
Asserts that the function throws an exception. | |
Asserts that the function throws an exception that contains the string | |
Asserts that the function throws an exception that matches the lua pattern | |
Asserts that the value is a boolean of | |
Asserts that the value is a "truthy" value, according to luau. | |
Asserts that the value is of type | |
Asserts that the value is of type | |
Asserts that the value is of type | |
Asserts that the actual value is a | |
Asserts that the actual value is a number within a specified range. |