restore

import { restore } from "jsr:@ende/testing/mock";

function

function restore(id?: number): void

Restores all mocks registered in the current session that have not already been restored. If an id is provided, it will restore all mocks registered in the session associed with that id that have not already been restored.

id?: number

The id of the session to restore. If not provided, all mocks registered in the current session are restored.

Example: Usage

import { mockSession, restore, stub } from "@ende/testing/mock";
import { assertEquals, assertNotEquals } from "@ende/assert";

const setTimeout = globalThis.setTimeout;

stub(globalThis, "setTimeout");

assertNotEquals(globalThis.setTimeout, setTimeout);

restore();

assertEquals(globalThis.setTimeout, setTimeout);

Source