Function restore
- restore(id?): void
Parameters
Optionalid: numberThe id of the session to restore. If not provided, all mocks registered in the current session are restored.
Returns void
Example: Usage
import { mockSession, restore, stub } from "@std/testing/mock";
import { assertEquals, assertNotEquals } from "@std/assert";
const setTimeout = globalThis.setTimeout;
stub(globalThis, "setTimeout");
assertNotEquals(globalThis.setTimeout, setTimeout);
restore();
assertEquals(globalThis.setTimeout, setTimeout);
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.