mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-07-17 05:43:36 +00:00
feat: refactor rbac/sharing to support new permissions and auth types
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { describe, it, expect, afterEach } from "vitest";
|
||||
import { isElectron } from "../../lib/electron.js";
|
||||
|
||||
const win = window as unknown as Record<string, unknown>;
|
||||
|
||||
afterEach(() => {
|
||||
delete win.IS_ELECTRON;
|
||||
delete win.electronAPI;
|
||||
});
|
||||
|
||||
describe("isElectron", () => {
|
||||
it("returns false in a plain browser window", () => {
|
||||
expect(isElectron()).toBe(false);
|
||||
});
|
||||
|
||||
it("returns true when IS_ELECTRON flag is set", () => {
|
||||
win.IS_ELECTRON = true;
|
||||
expect(isElectron()).toBe(true);
|
||||
});
|
||||
|
||||
it("returns true when electronAPI is present", () => {
|
||||
win.electronAPI = {};
|
||||
expect(isElectron()).toBe(true);
|
||||
});
|
||||
|
||||
it("returns true when electronAPI.isElectron is true", () => {
|
||||
win.electronAPI = { isElectron: true };
|
||||
expect(isElectron()).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user