feat: implement backend error handling and improve error messaging in Server component

This commit is contained in:
hamster1963
2026-07-05 13:17:36 +08:00
parent d295d549da
commit 056c357b6e
12 changed files with 187 additions and 27 deletions
@@ -180,6 +180,17 @@ describe("ServerFlag", () => {
expect(container.querySelector(".fi-us")).toBeInTheDocument();
});
it("normalizes SVG flag classes and ignores invalid country codes", () => {
Object.assign(window, { ForceUseSvgFlag: true });
const { container, rerender } = render(<ServerFlag country_code="US" />);
expect(container.querySelector(".fi-us")).toBeInTheDocument();
rerender(<ServerFlag country_code="u" />);
expect(container).toBeEmptyDOMElement();
});
it("uses emoji flags when the canvas probe detects support", async () => {
Object.assign(window, { ForceUseSvgFlag: false });
const originalCreateElement = document.createElement.bind(document);