clearMocks

external fun clearMocks()(source)

Clears mocked functions/data injected by the other functions in this module. When using a test runner that doesn't provide a fresh window object for each test, calling this function will reset tauri specific properties.

Example

import { mockWindows, clearMocks } from "@tauri-apps/api/mocks"

afterEach(() => {
clearMocks()
})

test("mocked windows", () => {
mockWindows("main", "second", "third");

expect(window.__TAURI_INTERNALS__).toHaveProperty("metadata")
})

test("no mocked windows", () => {
expect(window.__TAURI_INTERNALS__).not.toHaveProperty("metadata")
})

Since

1.0.0