Use globalThis instead of window (S7764)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 00:30:33 +08:00
parent ebd198e28d
commit 5d143d4cc3
8 changed files with 21 additions and 21 deletions

View File

@@ -235,13 +235,13 @@ describe("filesStore", () => {
it("downloads CSV for a log", async () => {
mockGet.mockResolvedValue({ data: "col1,col2\na,b" });
window.URL.createObjectURL = vi.fn().mockReturnValue("blob:test");
window.URL.revokeObjectURL = vi.fn();
globalThis.URL.createObjectURL = vi.fn().mockReturnValue("blob:test");
globalThis.URL.revokeObjectURL = vi.fn();
await store.downloadFileCSV("log", 3, "my-file");
expect(mockGet).toHaveBeenCalledWith("/api/logs/3/csv");
expect(window.URL.revokeObjectURL).toHaveBeenCalledWith("blob:test");
expect(globalThis.URL.revokeObjectURL).toHaveBeenCalledWith("blob:test");
});
it("returns early for unsupported type", async () => {