fix(ui,i18n): E30 review round 1 — audit rows in the reader's language, one HU name per thing
- audit log: a job run named from its result data (nested phases too), a skipped run says so, a secret's reset reads as a reset, choices named as Configuration names them, interval / batch / counts localized; the inbox shares the same jobRunText - HU: remux is "Közvetlen közvetítés" (it shared "Közvetlen lejátszás" with direct play); backfill is behúzás, enrich is dúsítás, collection is kollekció, the allow-list is fehérlista; the last "jobnak" / "transzkódolás"; a test holds the options of one choice to distinct names - contract: every skipped / reason word a job returns is named in both languages - person page: the bio wait is timed from the open and a failing ask stops the polling; ClampedText (ui) shared with the collection page, whose short summary lost its dead More - a playlist names season 0 the Specials; the channel re-slot compares in the reader's alphabet; an invite's date is in the admin's language; the language-ordered lists are asked again once a language switch is saved (saveLanguage) - poster grids' column minimum in rem; lint refuses minmax(Npx,…)
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
// @vitest-environment jsdom
|
||||
//
|
||||
// E30 review: the server orders some lists by the reader's STORED language (their keys carry none), so a
|
||||
// switch must re-ask for them — after the save lands, not before (the server would sort in the old one).
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { QueryClient } from "@tanstack/react-query";
|
||||
import { api } from "./api";
|
||||
import { LANGUAGE_ORDERED, qk } from "./queryKeys";
|
||||
import { saveLanguage } from "./saveLanguage";
|
||||
|
||||
afterEach(() => vi.restoreAllMocks());
|
||||
|
||||
describe("saveLanguage", () => {
|
||||
it("asks again for the server-ordered lists once the save has landed", async () => {
|
||||
let land!: () => void;
|
||||
vi.spyOn(api, "savePrefs").mockReturnValue(
|
||||
new Promise<never>((r) => (land = r as () => void)) as never,
|
||||
);
|
||||
const qc = new QueryClient();
|
||||
const asked = vi.spyOn(qc, "invalidateQueries");
|
||||
const done = saveLanguage(qc, "hu");
|
||||
await Promise.resolve();
|
||||
expect(asked).not.toHaveBeenCalled(); // the server still sorts in the old language
|
||||
land();
|
||||
await done;
|
||||
const keys = asked.mock.calls.map((c) => c[0]?.queryKey);
|
||||
expect(keys).toEqual([...LANGUAGE_ORDERED]);
|
||||
expect(keys).toContainEqual(qk.feed());
|
||||
expect(keys).toContainEqual(qk.channels());
|
||||
});
|
||||
|
||||
it("leaves the lists alone when the save fails", async () => {
|
||||
vi.spyOn(api, "savePrefs").mockRejectedValue(new Error("offline"));
|
||||
const qc = new QueryClient();
|
||||
const asked = vi.spyOn(qc, "invalidateQueries");
|
||||
await expect(saveLanguage(qc, "hu")).rejects.toThrow("offline");
|
||||
expect(asked).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user