FuncType - v0.45.0
    Preparing search index...

    Interface TestClockType

    TestClock interface for controlling time in tests

    interface TestClockType {
        currentTime: number;
        pendingCount: number;
        advance(ms: number): Promise<void>;
        runAll(): Promise<void>;
        setTime(ms: number): Promise<void>;
        sleep(ms: number): Promise<void>;
    }
    Index

    Properties

    currentTime: number

    Current virtual time in milliseconds

    pendingCount: number

    Gets the number of pending scheduled tasks.

    Methods

    • Advances the clock by the specified duration. All scheduled tasks with a time <= new current time will be executed.

      Parameters

      • ms: number

        Milliseconds to advance

      Returns Promise<void>

    • Runs all pending tasks immediately.

      Returns Promise<void>

    • Sets the clock to a specific time.

      Parameters

      • ms: number

        The absolute time to set

      Returns Promise<void>

    • Sleeps for the specified duration using virtual time.

      Parameters

      • ms: number

        Milliseconds to sleep

      Returns Promise<void>