Skip to main content

Interface: RecetaMatchers<R>

Defined in: testing/types.ts:87

Combined matcher interface for all Receta types.

Extends

Type Parameters

R

R = unknown

Methods

toBeErr()

toBeErr<E>(expectedError?): R

Defined in: testing/types.ts:31

Assert that a Result is Err, optionally checking the error.

Type Parameters

E

E

Parameters

expectedError?

E

Returns

R

Example

expect(err('fail')).toBeErr()
expect(err('fail')).toBeErr('fail')
expect(ok(5)).not.toBeErr()

Inherited from

ResultMatchers.toBeErr


toBeNone()

toBeNone(): R

Defined in: testing/types.ts:70

Assert that an Option is None.

Returns

R

Example

expect(none()).toBeNone()
expect(some(5)).not.toBeNone()

Inherited from

OptionMatchers.toBeNone


toBeOk()

toBeOk<T>(expectedValue?): R

Defined in: testing/types.ts:19

Assert that a Result is Ok, optionally checking the value.

Type Parameters

T

T

Parameters

expectedValue?

T

Returns

R

Example

expect(ok(5)).toBeOk()
expect(ok(5)).toBeOk(5)
expect(err('fail')).not.toBeOk()

Inherited from

ResultMatchers.toBeOk


toBeSome()

toBeSome<T>(expectedValue?): R

Defined in: testing/types.ts:59

Assert that an Option is Some, optionally checking the value.

Type Parameters

T

T

Parameters

expectedValue?

T

Returns

R

Example

expect(some(5)).toBeSome()
expect(some(5)).toBeSome(5)
expect(none()).not.toBeSome()

Inherited from

OptionMatchers.toBeSome


toEqualOption()

toEqualOption<T>(expected): R

Defined in: testing/types.ts:81

Deep equality check for Option types.

Type Parameters

T

T

Parameters

expected

unknown

Returns

R

Example

expect(some(5)).toEqualOption(some(5))
expect(none()).toEqualOption(none())

Inherited from

OptionMatchers.toEqualOption


toEqualResult()

toEqualResult<T, E>(expected): R

Defined in: testing/types.ts:42

Deep equality check for Result types.

Type Parameters

T

T

E

E

Parameters

expected

unknown

Returns

R

Example

expect(ok(5)).toEqualResult(ok(5))
expect(err('fail')).toEqualResult(err('fail'))

Inherited from

ResultMatchers.toEqualResult