FuncType - v1.21.0
    Preparing search index...

    Variable TestClock

    TestClock: {
        advance: (ms: number) => IO<TestClock, never, void>;
        context: () => { clock: TestClock; context: Context<TestClock> };
        make: () => TestClock;
        setTime: (ms: number) => IO<TestClock, never, void>;
        tag: Tag<TestClock>;
        test: <A>(f: (clock: TestClock) => Promise<A>) => Promise<A>;
        get get(): IO<TestClock, never, TestClock>;
        get runAll(): IO<TestClock, never, void>;
    }

    TestClock companion object with factory methods

    Type Declaration

    • advance: (ms: number) => IO<TestClock, never, void>

      Creates an IO that advances the TestClock.

    • context: () => { clock: TestClock; context: Context<TestClock> }

      Creates a context with a TestClock for testing.

    • make: () => TestClock

      Creates a new TestClock instance

    • setTime: (ms: number) => IO<TestClock, never, void>

      Creates an IO that sets the TestClock time.

    • tag: Tag<TestClock>

      Tag for dependency injection

    • test: <A>(f: (clock: TestClock) => Promise<A>) => Promise<A>

      Creates a test environment with a TestClock and runs the test function.

      await TestClock.test(async (clock) => {
      const result = await IO.sleep(100).map(() => "done")
      .pipe(clock.runWithClock)
      expect(result).toBe("done")
      })
    • get get(): IO<TestClock, never, TestClock>

      Creates an IO that accesses the TestClock from the environment.

    • get runAll(): IO<TestClock, never, void>

      Creates an IO that runs all pending tasks.