Addresses #44 (closed after the v0.8.3 release builds are green). Three independent defects in one shared tool-resolution path: bundled tools were looked up at the wrong path (so bundled fallback never worked, for PostgreSQL too), macOS GUI apps inherit launchd's minimal PATH, and only mariadb-dump/mariadb were probed — never mysqldump/mysql, which is what brew install mysql-client installs. Both engines now resolve through one headless, cached, timed resolver, plus a non-blocking client/server version warning. Also fixes passing MySQL-only CLI options to the bundled MariaDB client, and carries the tool-page UI polish and the requested #40 icon revert.
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
|
|
const listeners = vi.hoisted(
|
|
() => ({} as Record<string, (e: { payload: unknown }) => void>),
|
|
);
|
|
vi.mock("@tauri-apps/api/event", () => ({
|
|
listen: vi.fn(async (name: string, cb: (e: { payload: unknown }) => void) => {
|
|
listeners[name] = cb;
|
|
return () => {};
|
|
}),
|
|
}));
|
|
|
|
import { useBackupStore } from "./backupStore";
|
|
import { useNotificationStore } from "./notificationStore";
|
|
|
|
describe("backupStore advisory warning", () => {
|
|
beforeEach(() => {
|
|
useNotificationStore.setState({ notifications: [] });
|
|
useBackupStore.setState({ jobs: [], activeJobId: null, progress: 0 });
|
|
});
|
|
|
|
it("surfaces a non-fatal warning as an info notification", async () => {
|
|
await useBackupStore.getState().initListener();
|
|
listeners["backup-progress"]({
|
|
payload: {
|
|
job_id: "j1",
|
|
status: "running",
|
|
progress: 0,
|
|
warning: "Client/server version mismatch: the resolved dump tool is old",
|
|
},
|
|
});
|
|
const notes = useNotificationStore.getState().notifications;
|
|
expect(notes.some((n) => n.message.includes("version mismatch"))).toBe(true);
|
|
expect(notes.some((n) => n.type === "info")).toBe(true);
|
|
});
|
|
});
|