@rbxts/expect > Assertion > closeTo
Assertion.closeTo() method
Asserts that the actual value is a number within margin
of value
.
Signature:
closeTo(value: number, margin: number): Assertion<number>;
Parameters
Parameter | Type | Description |
---|---|---|
value | number | The number that the actual value should be |
margin | number | A range of which the actual value should be +- |
Returns:
Assertion<number>
Remarks
Type alias for .
Example
expect(11).to.be.closeTo(10, 1);
expect(100).to.be.closeTo(125, 50);
expect(5.005).to.be.closeTo(5, .01)