feat: align frontend languages with posts api
This commit is contained in:
@@ -8,7 +8,7 @@ function makePost(id: string, isoDate: string): Post {
|
||||
id,
|
||||
categoryId: 1,
|
||||
categorySlug: "x",
|
||||
language: "zh-CN",
|
||||
language: "zh",
|
||||
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-CN"));
|
||||
const { result } = renderHook(() => useGroupedByDay(posts, "zh"));
|
||||
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-CN"));
|
||||
const { result } = renderHook(() => useGroupedByDay([], "zh"));
|
||||
expect(result.current).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user