fix(notifications): a notice keeps what to say and says it in the reader's language when shown
This commit is contained in:
@@ -17,7 +17,7 @@ vi.mock("./api", () => ({ api: { savePrefs, me: vi.fn() } }));
|
||||
vi.mock("./actionErrors", () => ({ notifyActionError }));
|
||||
|
||||
import { usePref, useSavePref } from "./usePref";
|
||||
import i18n from "../i18n";
|
||||
import { msg } from "./notifications";
|
||||
|
||||
afterEach(() => {
|
||||
savePrefs.mockReset();
|
||||
@@ -34,7 +34,7 @@ describe("a refused preference save", () => {
|
||||
const { result } = renderHook(() => usePref<boolean>("hintsOn", true), { wrapper });
|
||||
act(() => result.current[1](false));
|
||||
await waitFor(() =>
|
||||
expect(notifyActionError).toHaveBeenCalledWith(refusal, i18n.t("errors.writeFailed.prefs")),
|
||||
expect(notifyActionError).toHaveBeenCalledWith(refusal, msg("errors.writeFailed.prefs")),
|
||||
);
|
||||
expect(result.current[0]).toBe(false); // the local value stays; the toast says it did not save
|
||||
});
|
||||
@@ -45,7 +45,7 @@ describe("a refused preference save", () => {
|
||||
const { result } = renderHook(() => useSavePref(), { wrapper });
|
||||
act(() => result.current({ stripSources: { c1: false } }));
|
||||
await waitFor(() =>
|
||||
expect(notifyActionError).toHaveBeenCalledWith(refusal, i18n.t("errors.writeFailed.prefs")),
|
||||
expect(notifyActionError).toHaveBeenCalledWith(refusal, msg("errors.writeFailed.prefs")),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user