mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 06:05:24 +00:00
41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
const success = vi.fn();
|
|
vi.mock("sonner", () => ({
|
|
toast: {
|
|
success: (...args: unknown[]) => success(...args),
|
|
},
|
|
}));
|
|
|
|
vi.mock("@/main-axios.ts", () => ({}));
|
|
vi.mock("../../src/frontend/transferNotificationStore.ts", () => ({
|
|
markTransferNotified: vi.fn(),
|
|
}));
|
|
|
|
import { showTransferCompletionToast } from "../../src/frontend/transferProgressMonitor.tsx";
|
|
|
|
describe("transfer completion toast", () => {
|
|
beforeEach(() => {
|
|
success.mockReset();
|
|
});
|
|
|
|
it("clears the infinite duration inherited from the progress toast", () => {
|
|
showTransferCompletionToast(
|
|
{
|
|
transferId: "transfer-1",
|
|
status: "success",
|
|
phase: "verifying",
|
|
},
|
|
((key: string) => key) as never,
|
|
"progress-toast",
|
|
);
|
|
|
|
expect(success).toHaveBeenCalledWith("transfer.transferSuccess", {
|
|
id: "progress-toast",
|
|
description: undefined,
|
|
className: "!pr-10 !pl-4 transfer-progress-toast",
|
|
duration: undefined,
|
|
});
|
|
});
|
|
});
|