fix(notifications): a notice keeps what to say and says it in the reader's language when shown
This commit is contained in:
@@ -116,6 +116,7 @@ vi.mock("../../components/ui/PageShell", async (importOriginal) => ({
|
||||
}));
|
||||
|
||||
import Files from "./Files";
|
||||
import { msg } from "../../lib/notifications";
|
||||
import { FILES_LIST_CAP, type QueueJob } from "../../lib/api";
|
||||
import { noteQueue, resetQueueWatch, useFinished } from "../../lib/downloadQueue";
|
||||
|
||||
@@ -589,10 +590,13 @@ describe("Files · a library past the list's cap", { timeout: 30_000 }, () => {
|
||||
await waitFor(() =>
|
||||
expect(mocks.notify).toHaveBeenCalledWith({
|
||||
level: "info",
|
||||
message: "files.arrival.notListed",
|
||||
message: msg("files.arrival.notListed"),
|
||||
}),
|
||||
);
|
||||
expect(mocks.notify).not.toHaveBeenCalledWith({ level: "info", message: "files.arrival.gone" });
|
||||
expect(mocks.notify).not.toHaveBeenCalledWith({
|
||||
level: "info",
|
||||
message: msg("files.arrival.gone"),
|
||||
});
|
||||
});
|
||||
|
||||
it("an arrival's cleared search is asked of the server at once, not after the typing pause", () => {
|
||||
@@ -805,7 +809,7 @@ describe("Files · a file the address names", () => {
|
||||
mount();
|
||||
await waitFor(() =>
|
||||
expect(mocks.notify).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ level: "warning", message: "files.linkedGone" }),
|
||||
expect.objectContaining({ level: "warning", message: msg("files.linkedGone") }),
|
||||
),
|
||||
);
|
||||
expect(screen.queryByRole("dialog")).toBeNull();
|
||||
@@ -822,11 +826,11 @@ describe("Files · a file the address names", () => {
|
||||
mount();
|
||||
await waitFor(() =>
|
||||
expect(mocks.notify).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ level: "info", message: "files.linkedNotListed" }),
|
||||
expect.objectContaining({ level: "info", message: msg("files.linkedNotListed") }),
|
||||
),
|
||||
);
|
||||
expect(mocks.notify).not.toHaveBeenCalledWith(
|
||||
expect.objectContaining({ message: "files.linkedGone" }),
|
||||
expect.objectContaining({ message: msg("files.linkedGone") }),
|
||||
);
|
||||
expect(here().get("fview")).toBe("9999");
|
||||
}, 30_000); // a full page of FILES_LIST_CAP rows
|
||||
@@ -839,11 +843,11 @@ describe("Files · a file the address names", () => {
|
||||
mount();
|
||||
await waitFor(() =>
|
||||
expect(mocks.notify).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ level: "info", message: "files.linkedNotListed" }),
|
||||
expect.objectContaining({ level: "info", message: msg("files.linkedNotListed") }),
|
||||
),
|
||||
);
|
||||
expect(mocks.notify).not.toHaveBeenCalledWith(
|
||||
expect.objectContaining({ message: "files.linkedGone" }),
|
||||
expect.objectContaining({ message: msg("files.linkedGone") }),
|
||||
);
|
||||
expect(here().get("fview")).toBe("9999");
|
||||
}, 30_000); // a full page of FILES_LIST_CAP rows
|
||||
@@ -1344,7 +1348,10 @@ describe("Files · when what it needs is missing", () => {
|
||||
mocks.folders = [YT];
|
||||
mount(ALL_FILES, vi.fn(), "", { focus: { id: 9, token: 1 } });
|
||||
await waitFor(() =>
|
||||
expect(mocks.notify).toHaveBeenCalledWith({ level: "info", message: "files.arrival.gone" }),
|
||||
expect(mocks.notify).toHaveBeenCalledWith({
|
||||
level: "info",
|
||||
message: msg("files.arrival.gone"),
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user