refactor(web): extract isTauri into a leaf platform module
This commit is contained in:
17
packages/web/src/test/platform.test.ts
Normal file
17
packages/web/src/test/platform.test.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { isTauri } from "@/lib/platform";
|
||||
|
||||
describe("isTauri", () => {
|
||||
afterEach(() => {
|
||||
delete (window as unknown as Record<string, unknown>).__TAURI_INTERNALS__;
|
||||
});
|
||||
|
||||
it("returns false in a plain browser/jsdom environment", () => {
|
||||
expect(isTauri()).toBe(false);
|
||||
});
|
||||
|
||||
it("returns true when the Tauri internals global is present", () => {
|
||||
(window as unknown as Record<string, unknown>).__TAURI_INTERNALS__ = {};
|
||||
expect(isTauri()).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user