diff --git a/tests/server.test.tsx b/tests/server.test.tsx index a2357da9..a957fac8 100644 --- a/tests/server.test.tsx +++ b/tests/server.test.tsx @@ -14,22 +14,7 @@ describe("ServerInfo Component", () => { const titlebarContainer = document.createElement("div"); titlebarContainer.id = "titlebar"; document.body.appendChild(titlebarContainer); - beforeAll(() => { - Object.defineProperty(window, "crypto", { - value: { - getRandomValues: (buffer) => { - return randomFillSync(buffer); - } - } - }); - mockIPC((cmd: any, args: any) => { - if (cmd === "close_splashscreen") { - return Promise.resolve(); - } - }); - const spy = vi.spyOn(window, "__TAURI_IPC__"); - expect(invoke("close_splashscreen")).resolves.all; - }); + test("renders ServerInfo component with RTSP setting by default", () => { render( diff --git a/tests/setting.test.tsx b/tests/setting.test.tsx index 86c8cfb9..6531a9ab 100644 --- a/tests/setting.test.tsx +++ b/tests/setting.test.tsx @@ -18,16 +18,7 @@ describe("Setting Component", () => { titlebarContainer.id = "titlebar"; document.body.appendChild(titlebarContainer); - beforeAll(() => { - mockIPC((cmd, args) => { - if (cmd === "get_server_request") { - return Promise.resolve({ url: "http://127.0.0.1:9997/v3/config/global/get" }); - } - if (cmd === "patch_server_request") { - return Promise.resolve({ url: "http://127.0.0.1:9997/v3/config/global/patch"}); - } - }); - }); + test("renders Setting component", () => { render( @@ -200,42 +191,6 @@ describe("Setting Component", () => { }); - test("updates state and invokes save_api_ip", () => { - const initialSettings = { - apiSettings: { api: true }, - loggingSettings: { logLevel: "info" }, - hlsSettings: { hls: true }, - rtspSettings: { rtsp: true }, - rtmpSettings: { rtmp: true }, - srtSettings: { srt: true }, - webrtcSettings: { webrtc: true }, - recordSettings: { record: true }, - }; - - - - const expectedUpdatedSettings = { - apiSettings: { api: false, metrics: true }, - loggingSettings: { logLevel: "debug" }, - hlsSettings: { hls: false }, - rtspSettings: { rtsp: false }, - rtmpSettings: { rtmp: false }, - srtSettings: { srt: false }, - webrtcSettings: { webrtc: false }, - recordSettings: { record: false }, - }; - render( - - - - ); - invoke("patch_server_request", {url:"http://127.0.0.1:9997/v3/config/global/patch"}); - spyOn(window, "__TAURI_IPC__" as any); - expect(invoke("patch_server_request")).resolves.all; - - - expect(initialSettings).not.toEqual(expectedUpdatedSettings); - }); - - }); + + }); \ No newline at end of file