fix: follow-ups of the lot-v018 stack reviews #482
1 changed files with 25 additions and 0 deletions
|
|
@ -335,4 +335,29 @@ describe("ChangelogContent — language switch", () => {
|
||||||
expect(html).toContain("note-0171-en");
|
expect(html).toContain("note-0171-en");
|
||||||
expect(html).not.toMatch(/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)");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue