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.
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")}) Copy
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")})
1.0.0
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