Skip to content

utils

19 exports Added in v0.21.0 Source

Other

assertEquals

Added in v0.21.0 Source

Asserts that actual is equal to expected using the Equal.equals trait.

Signature

declare function assertEquals<A>(
  actual: A,
  expected: A,
  message?: string,
  ..._: Array<never>
): void;

assertFailure

Added in v0.21.0 Source

Asserts that exit is a failure.

Signature

declare function assertFailure<A, E>(
  exit: Exit<A, E>,
  expected: Cause<E>,
  ..._: Array<never>
): asserts exit is Failure<never, E>;

assertFalse

Added in v0.21.0 Source

Asserts that self is false.

Signature

declare function assertFalse(self: boolean, message?: string, ..._: Array<never>): void;

assertInclude

Added in v0.21.0 Source

Asserts that actual includes expected.

Signature

declare function assertInclude(
  actual: string | undefined,
  expected: string,
  ..._: Array<never>
): void;

Asserts that value is an instance of constructor.

Signature

declare function assertInstanceOf<C extends (...args: any) => any>(
  value: unknown,
  constructor: C,
  message?: string,
  ..._: Array<never>
): asserts value is InstanceType<C>;

assertLeft

Added in v0.21.0 Source

Asserts that either is Left.

Signature

declare function assertLeft<R, L>(
  either: Either<R, L>,
  expected: L,
  ..._: Array<never>
): asserts either is Left<L, never>;

assertMatch

Added in v0.21.0 Source

Asserts that actual matches regexp.

Signature

declare function assertMatch(actual: string, regexp: RegExp, ..._: Array<never>): void;

assertNone

Added in v0.21.0 Source

Asserts that option is None.

Signature

declare function assertNone<A>(
  option: Option<A>,
  ..._: Array<never>
): asserts option is None<never>;

assertRight

Added in v0.21.0 Source

Asserts that either is Right.

Signature

declare function assertRight<R, L>(
  either: Either<R, L>,
  expected: R,
  ..._: Array<never>
): asserts either is Right<never, R>;

assertSome

Added in v0.21.0 Source

Asserts that option is Some.

Signature

declare function assertSome<A>(
  option: Option<A>,
  expected: A,
  ..._: Array<never>
): asserts option is Some<A>;

assertSuccess

Added in v0.21.0 Source

Asserts that exit is a success.

Signature

declare function assertSuccess<A, E>(
  exit: Exit<A, E>,
  expected: A,
  ..._: Array<never>
): asserts exit is Success<A, never>;

assertTrue

Added in v0.21.0 Source

Asserts that self is true.

Signature

declare function assertTrue(self: unknown, message?: string, ..._: Array<never>): asserts self;

Asserts that actual is equal to expected using the Equal.equals trait.

Signature

declare function deepStrictEqual<A>(
  actual: A,
  expected: A,
  message?: string,
  ..._: Array<never>
): void;

doesNotThrow

Added in v0.21.0 Source

Asserts that thunk does not throw an error.

Signature

declare function doesNotThrow(thunk: () => void, message?: string, ..._: Array<never>): void;

fail

Added in v0.21.0 Source

Throws an AssertionError with the provided error message.

Signature

declare function fail(message: string): void;

Asserts that actual is not equal to expected using the Equal.equals trait.

Signature

declare function notDeepStrictEqual<A>(
  actual: A,
  expected: A,
  message?: string,
  ..._: Array<never>
): void;

strictEqual

Added in v0.21.0 Source

Asserts that actual is equal to expected using the Equal.equals trait.

Signature

declare function strictEqual<A>(actual: A, expected: A, message?: string, ..._: Array<never>): void;

throws

Added in v0.21.0 Source

Asserts that thunk throws an error.

Signature

declare function throws(thunk: () => void, error?: Error | (u: unknown) => undefined, ..._: Array<never>): void

throwsAsync

Added in v0.21.0 Source

Asserts that thunk throws an error.

Signature

declare function throwsAsync(thunk: () => Promise<void>, error?: Error | (u: unknown) => undefined, ..._: Array<never>): Promise<void>