FuncType - v0.45.0
    Preparing search index...

    Type Alias TestClockType

    TestClock companion object with factory methods

    type TestClockType = {
        advance: (ms: number) => IOType<TestClockType, never, void>;
        context: () => {
            clock: TestClockType;
            context: ContextType<TestClockType>;
        };
        get: IOType<TestClockType, never, TestClockType>;
        make: () => TestClockType;
        runAll: IOType<TestClockType, unknown, void>;
        setTime: (ms: number) => IOType<TestClockType, never, void>;
        tag: TagType<TestClockType>;
        test: <A>(f: (clock: TestClockType) => Promise<A>) => Promise<A>;
    }
    Index

    Properties

    advance: (ms: number) => IOType<TestClockType, never, void> = ...

    Creates an IO that advances the TestClock.

    context: () => { clock: TestClockType; context: ContextType<TestClockType> } = ...

    Creates a context with a TestClock for testing.

    get: IOType<TestClockType, never, TestClockType> = ...

    Creates an IO that accesses the TestClock from the environment.

    make: () => TestClockType = createTestClock

    Creates a new TestClock instance

    Type Declaration

    runAll: IOType<TestClockType, unknown, void> = ...

    Creates an IO that runs all pending tasks.

    setTime: (ms: number) => IOType<TestClockType, never, void> = ...

    Creates an IO that sets the TestClock time.

    tag: TagType<TestClockType> = TestClockTag

    Tag for dependency injection

    test: <A>(f: (clock: TestClockType) => 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")
    })