Assertion Interface
veve / Assertion
Class: Assertion()
Defined in: framework/Assertion.ts:16
Assertion(
value
):boolean
|Assertion
Defined in: framework/Assertion.ts:383
Asserts that the function has returned with a specific value.
Parameters
value
any
The expected return value
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Constructors
new Assertion()
new Assertion(
received
,throws
):Assertion
Defined in: framework/Assertion.ts:446
Parameters
received
any
throws
boolean
Returns
Properties
isNot
isNot:
boolean
Defined in: framework/Assertion.ts:442
isTracked
isTracked:
boolean
=false
Defined in: framework/Assertion.ts:443
received
received:
any
Defined in: framework/Assertion.ts:441
throws
throws:
boolean
=false
Defined in: framework/Assertion.ts:444
Accessors
not
Get Signature
get not():
this
Defined in: framework/Assertion.ts:453
Returns
this
rejects
Get Signature
get rejects():
this
Defined in: framework/Assertion.ts:477
Returns
this
resolves
Get Signature
get resolves():
this
Defined in: framework/Assertion.ts:458
Returns
this
Methods
toBe()
Call Signature
toBe(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:165
Asserts that the received value is strictly equal to the expected value.
Parameters
expected
any
The expected value
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBe(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:643
Asserts that the received value is strictly equal to the expected value.
Parameters
expected
any
The expected value
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toBeAboveMin()
Call Signature
toBeAboveMin(
min
):boolean
|Assertion
Defined in: framework/Assertion.ts:206
Asserts that the received value is greater than or equal to the min value.
Parameters
min
The minimum value (inclusive)
number
| bigint
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBeAboveMin(
min
):boolean
|Assertion
Defined in: framework/Assertion.ts:614
Asserts that the received value is greater than or equal to the min value.
Parameters
min
The minimum value (inclusive)
number
| bigint
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toBeBelowMax()
Call Signature
toBeBelowMax(
max
):boolean
|Assertion
Defined in: framework/Assertion.ts:218
Asserts that the received value is less than or equal to the max value.
Parameters
max
The maximum value (inclusive)
number
| bigint
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBeBelowMax(
max
):boolean
|Assertion
Defined in: framework/Assertion.ts:622
Asserts that the received value is less than or equal to the max value.
Parameters
max
The maximum value (inclusive)
number
| bigint
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toBeBetween()
Call Signature
toBeBetween(
min
,max
):boolean
|Assertion
Defined in: framework/Assertion.ts:178
Asserts that the received value is strictly between the min and max (exclusive).
Parameters
min
The lower bound (exclusive)
number
| bigint
max
The upper bound (exclusive)
number
| bigint
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBeBetween(
min
,max
):boolean
|Assertion
Defined in: framework/Assertion.ts:598
Asserts that the received value is strictly between the min and max (exclusive).
Parameters
min
The lower bound (exclusive)
number
| bigint
max
The upper bound (exclusive)
number
| bigint
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toBeBetweenOrEqual()
Call Signature
toBeBetweenOrEqual(
min
,max
):boolean
|Assertion
Defined in: framework/Assertion.ts:191
Asserts that the received value is between the min and max (inclusive).
Parameters
min
The lower bound (inclusive)
number
| bigint
max
The upper bound (inclusive)
number
| bigint
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBeBetweenOrEqual(
min
,max
):boolean
|Assertion
Defined in: framework/Assertion.ts:606
Asserts that the received value is between the min and max (inclusive).
Parameters
min
The lower bound (inclusive)
number
| bigint
max
The upper bound (inclusive)
number
| bigint
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toBeCloseTo()
Call Signature
toBeCloseTo(
expected
,numDigits
?):boolean
|Assertion
Defined in: framework/Assertion.ts:265
Asserts that the number is close to another number within a specified precision.
Parameters
expected
number
The expected number
numDigits?
number
The number of decimal places to compare
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBeCloseTo(
expected
,numDigits
):boolean
|Assertion
Defined in: framework/Assertion.ts:686
Asserts that the number is close to another number within a specified precision.
Parameters
expected
number
The expected number
numDigits
number
= 2
The number of decimal places to compare
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toBeDefined()
Call Signature
toBeDefined():
boolean
|Assertion
Defined in: framework/Assertion.ts:26
Asserts that the received value is defined (not undefined
).
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBeDefined():
boolean
|Assertion
Defined in: framework/Assertion.ts:510
Asserts that the received value is defined (not undefined
).
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toBeFalsy()
Call Signature
toBeFalsy():
boolean
|Assertion
Defined in: framework/Assertion.ts:70
Asserts that the received value evaluates to false
in a boolean context.
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBeFalsy():
boolean
|Assertion
Defined in: framework/Assertion.ts:542
Asserts that the received value evaluates to false
in a boolean context.
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toBeGreaterThan()
Call Signature
toBeGreaterThan(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:82
Asserts that the received value is greater than the expected value.
Parameters
expected
The expected value
number
| bigint
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBeGreaterThan(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:550
Asserts that the received value is greater than the expected value.
Parameters
expected
The expected value
number
| bigint
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toBeGreaterThanOrEqual()
Call Signature
toBeGreaterThanOrEqual(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:94
Asserts that the received value is greater than or equal to the expected value.
Parameters
expected
The expected value
number
| bigint
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBeGreaterThanOrEqual(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:558
Asserts that the received value is greater than or equal to the expected value.
Parameters
expected
The expected value
number
| bigint
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toBeInstanceOf()
Call Signature
toBeInstanceOf(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:118
Asserts that the received value is an instance of the given class.
Parameters
expected
any
The class to check against
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBeInstanceOf(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:574
Asserts that the received value is an instance of the given class.
Parameters
expected
any
The class to check against
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toBeLessThan()
Call Signature
toBeLessThan(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:106
Asserts that the received value is less than the expected value.
Parameters
expected
The expected value
number
| bigint
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBeLessThan(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:566
Asserts that the received value is less than the expected value.
Parameters
expected
The expected value
number
| bigint
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toBeLessThanOrEqual()
Call Signature
toBeLessThanOrEqual(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:130
Asserts that the received value is less than or equal to the expected value.
Parameters
expected
The expected value
number
| bigint
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBeLessThanOrEqual(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:582
Asserts that the received value is less than or equal to the expected value.
Parameters
expected
The expected value
number
| bigint
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toBeNaN()
Call Signature
toBeNaN():
boolean
|Assertion
Defined in: framework/Assertion.ts:141
Asserts that the received value is NaN
.
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBeNaN():
boolean
|Assertion
Defined in: framework/Assertion.ts:590
Asserts that the received value is NaN
.
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toBeNull()
Call Signature
toBeNull():
boolean
|Assertion
Defined in: framework/Assertion.ts:48
Asserts that the received value is null
.
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBeNull():
boolean
|Assertion
Defined in: framework/Assertion.ts:526
Asserts that the received value is null
.
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toBeTracked()
Call Signature
toBeTracked():
boolean
|Assertion
Defined in: framework/Assertion.ts:276
Asserts that the received function is tracked.
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBeTracked():
boolean
|Assertion
Defined in: framework/Assertion.ts:775
Asserts that the received function is tracked.
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toBeTruthy()
Call Signature
toBeTruthy():
boolean
|Assertion
Defined in: framework/Assertion.ts:59
Asserts that the received value evaluates to true
in a boolean context.
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBeTruthy():
boolean
|Assertion
Defined in: framework/Assertion.ts:534
Asserts that the received value evaluates to true
in a boolean context.
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toBeUndefined()
Call Signature
toBeUndefined():
boolean
|Assertion
Defined in: framework/Assertion.ts:37
Asserts that the received value is undefined
.
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toBeUndefined():
boolean
|Assertion
Defined in: framework/Assertion.ts:518
Asserts that the received value is undefined
.
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toContain()
Call Signature
toContain(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:242
Asserts that the received value contains the expected value.
Parameters
expected
any
The expected value
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toContain(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:661
Asserts that the received value contains the expected value.
Parameters
expected
any
The expected value
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toEqual()
Call Signature
toEqual(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:230
Asserts that the received value is deeply equal to the expected value.
Parameters
expected
any
The expected value
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toEqual(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:651
Asserts that the received value is deeply equal to the expected value.
Parameters
expected
any
The expected value
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toHaveBeenCalled()
Call Signature
toHaveBeenCalled():
boolean
|Assertion
Defined in: framework/Assertion.ts:288
Asserts that the received function has been called.
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toHaveBeenCalled():
boolean
|Assertion
Defined in: framework/Assertion.ts:783
Asserts that the received function has been called.
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toHaveBeenCalledTimes()
Call Signature
toHaveBeenCalledTimes(
times
):boolean
|Assertion
Defined in: framework/Assertion.ts:302
Asserts that the received function has been called exactly n times.
Parameters
times
number
The expected number of calls
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toHaveBeenCalledTimes(
times
):boolean
|Assertion
Defined in: framework/Assertion.ts:796
Asserts that the received function has been called exactly n times.
Parameters
times
number
The expected number of calls
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toHaveBeenCalledWith()
Call Signature
toHaveBeenCalledWith(...
args
):boolean
|Assertion
Defined in: framework/Assertion.ts:315
Asserts that the received function was called with specific arguments.
Parameters
args
...any
[]
The expected arguments
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toHaveBeenCalledWith(...
args
):boolean
|Assertion
Defined in: framework/Assertion.ts:809
Asserts that the received function was called with specific arguments.
Parameters
args
...any
[]
The expected arguments
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toHaveBeenLastCalledWith()
Call Signature
toHaveBeenLastCalledWith(...
args
):boolean
|Assertion
Defined in: framework/Assertion.ts:329
Asserts that the function was last called with specific arguments.
Parameters
args
...any
[]
The expected arguments
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toHaveBeenLastCalledWith(...
args
):boolean
|Assertion
Defined in: framework/Assertion.ts:822
Asserts that the function was last called with specific arguments.
Parameters
args
...any
[]
The expected arguments
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toHaveBeenNthCalledWith()
Call Signature
toHaveBeenNthCalledWith(
n
, ...args
):boolean
|Assertion
Defined in: framework/Assertion.ts:344
Asserts that the nth call of the function was with specific arguments.
Parameters
n
number
The call number to check (1-indexed)
args
...any
[]
The expected arguments
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toHaveBeenNthCalledWith(
n
, ...args
):boolean
|Assertion
Defined in: framework/Assertion.ts:837
Asserts that the nth call of the function was with specific arguments.
Parameters
n
number
The call number to check (1-indexed)
args
...any
[]
The expected arguments
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toHaveLastReturnedWith()
Call Signature
toHaveLastReturnedWith(
value
):boolean
|Assertion
Defined in: framework/Assertion.ts:397
Asserts that the function's last return was a specific value.
Parameters
value
any
The expected return value
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toHaveLastReturnedWith(
value
):boolean
|Assertion
Defined in: framework/Assertion.ts:891
Asserts that the function's last return was a specific value.
Parameters
value
any
The expected return value
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toHaveLength()
Call Signature
toHaveLength(
length
):boolean
|Assertion
Defined in: framework/Assertion.ts:424
Asserts that the received value has a specific length.
Parameters
length
number
The expected length
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toHaveLength(
length
):boolean
|Assertion
Defined in: framework/Assertion.ts:921
Asserts that the received value has a specific length.
Parameters
length
number
The expected length
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toHaveNthReturnedWith()
Call Signature
toHaveNthReturnedWith(
n
,value
):boolean
|Assertion
Defined in: framework/Assertion.ts:412
Asserts that the nth return of the function was a specific value.
Parameters
n
number
The return number to check (1-indexed)
value
any
The expected return value
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toHaveNthReturnedWith(
n
,value
):boolean
|Assertion
Defined in: framework/Assertion.ts:906
Asserts that the nth return of the function was a specific value.
Parameters
n
number
The return number to check (1-indexed)
value
any
The expected return value
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toHaveProperty()
Call Signature
toHaveProperty(
keyPath
,value
?):boolean
|Assertion
Defined in: framework/Assertion.ts:437
Asserts that the received object has a specific property.
Parameters
keyPath
string
The dot-notation path to the property
value?
any
The expected property value
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toHaveProperty(
keyPath
,value
?):boolean
|Assertion
Defined in: framework/Assertion.ts:929
Asserts that the received object has a specific property.
Parameters
keyPath
string
The dot-notation path to the property
value?
any
The expected property value
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toHaveReturned()
Call Signature
toHaveReturned():
boolean
|Assertion
Defined in: framework/Assertion.ts:356
Asserts that the function has returned at least once.
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toHaveReturned():
boolean
|Assertion
Defined in: framework/Assertion.ts:852
Asserts that the function has returned at least once.
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toHaveReturnedTimes()
Call Signature
toHaveReturnedTimes(
times
):boolean
|Assertion
Defined in: framework/Assertion.ts:370
Asserts that the function has returned exactly n times.
Parameters
times
number
The expected number of returns
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toHaveReturnedTimes(
times
):boolean
|Assertion
Defined in: framework/Assertion.ts:863
Asserts that the function has returned exactly n times.
Parameters
times
number
The expected number of returns
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toHaveReturnedWith()
toHaveReturnedWith(
value
):boolean
|Assertion
Defined in: framework/Assertion.ts:876
Parameters
value
any
Returns
boolean
| Assertion
toMatch()
Call Signature
toMatch(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:153
Asserts that the received value matches the provided pattern.
Parameters
expected
The expected pattern
string
| RegExp
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toMatch(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:630
Asserts that the received value matches the provided pattern.
Parameters
expected
The expected pattern
string
| RegExp
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
toThrow()
Call Signature
toThrow(
expected
):boolean
|Assertion
Defined in: framework/Assertion.ts:253
Asserts that a tracked function throws an expected exception.
Parameters
expected
any
The expected exception
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails
Example
Call Signature
toThrow(
expected
?):boolean
|Assertion
Defined in: framework/Assertion.ts:698
Asserts that a tracked function throws an expected exception.
Parameters
expected?
The expected exception
string
| RegExp
| Error
Returns
boolean
| Assertion
The assertion result
Throws
If the assertion fails