fix: unify chinese language code as zh-CN

This commit is contained in:
TerryM
2026-05-26 10:03:12 +08:00
parent f2e97c329e
commit f482a2ec38
13 changed files with 53 additions and 50 deletions

View File

@@ -8,7 +8,7 @@ function makePost(id: string, isoDate: string): Post {
id,
categoryId: 1,
categorySlug: "x",
language: "zh",
language: "zh-CN",
attachments: [],
isRecommended: false,
publishedAt: isoDate,
@@ -25,7 +25,7 @@ describe("useGroupedByDay", () => {
makePost("c", "2026-02-28T01:00:00.000Z"),
makePost("d", "2026-05-16T12:00:00.000Z"),
];
const { result } = renderHook(() => useGroupedByDay(posts, "zh"));
const { result } = renderHook(() => useGroupedByDay(posts, "zh-CN"));
expect(result.current.length).toBeGreaterThanOrEqual(2);
const allIds = result.current.flatMap((g) => g.items.map((p) => p.id));
expect(allIds).toEqual(["a", "b", "c", "d"]);
@@ -47,7 +47,7 @@ describe("useGroupedByDay", () => {
});
it("returns empty array for empty input", () => {
const { result } = renderHook(() => useGroupedByDay([], "zh"));
const { result } = renderHook(() => useGroupedByDay([], "zh-CN"));
expect(result.current).toEqual([]);
});
});