FuncType - v1.21.0
    Preparing search index...

    Interface TestContext<R>

    TestContext provides a complete test environment with mocked services.

    interface TestContext<R extends Type> {
        clock: TestClock;
        context: Context<R>;
        run<E extends unknown, A extends unknown>(effect: IO<R, E, A>): Promise<A>;
        withService<S extends unknown>(tag: Tag<S>, service: S): TestContext<R & S>;
    }

    Type Parameters

    Index
    clock: TestClock

    The TestClock for controlling time

    context: Context<R>

    The context containing test services

    • Provides the test context to an IO effect and runs it

      Type Parameters

      • E extends unknown
      • A extends unknown

      Parameters

      Returns Promise<A>

    • Adds a service to the test context

      Type Parameters

      • S extends unknown

      Parameters

      Returns TestContext<R & S>