fix: follow-ups of the lot-v018 stack reviews #482

Merged
maximus merged 25 commits from review-followups-lot-v018 into main 2026-10-21 00:31:46 +00:00
Showing only changes of commit 2389d51b48 - Show all commits

View file

@ -335,4 +335,29 @@ describe("ChangelogContent — language switch", () => {
expect(html).toContain("note-0171-en");
expect(html).not.toMatch(/note-0171(?!-en)/);
});
it("never lets a late failure of the previous language empty the current history", async () => {
const pending: Array<{ url: string; resolve: (text: string) => void; reject: (error: Error) => void }> = [];
fetchMock.mockImplementation(
(url: string) =>
new Promise<FetchedFile>((resolveFetch, rejectFetch) => {
pending.push({ url, resolve: (text) => resolveFetch({ text: async () => text }), reject: rejectFetch });
}),
);
render("0.17.1");
harness.commit(); // asks for the French file
ctx.language = "en";
render("0.17.1");
harness.commit(); // cancels the French one, asks for the English file
expect(pending.map((p) => p.url)).toEqual(["/CHANGELOG.fr.md", "/CHANGELOG.md"]);
pending[1].resolve(EN);
await settle();
pending[0].reject(new Error("the French file could not be read"));
await settle();
const html = renderToStaticMarkup(render("0.17.1"));
expect(html).toContain("note-0171-en");
expect(html).not.toContain("t(changelog.empty)");
});
});