feat(i18n): add localized navigation and news translations
This commit is contained in:
@@ -24,6 +24,9 @@ const { mockDb } = vi.hoisted(() => ({
|
||||
update: vi.fn(),
|
||||
delete: vi.fn(),
|
||||
},
|
||||
navigationItemTranslation: {
|
||||
upsert: vi.fn(),
|
||||
},
|
||||
},
|
||||
}))
|
||||
|
||||
@@ -38,6 +41,7 @@ import {
|
||||
getPublishedPageBySlugForLocale,
|
||||
listPublicNavigation,
|
||||
updatePage,
|
||||
upsertNavigationItemTranslation,
|
||||
upsertPageTranslation,
|
||||
} from "./pages-navigation"
|
||||
|
||||
@@ -112,22 +116,33 @@ describe("pages-navigation service", () => {
|
||||
slug: "home",
|
||||
status: "published",
|
||||
},
|
||||
translations: [{ locale: "de", label: "Startseite" }],
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const navigation = await listPublicNavigation("header")
|
||||
const navigation = await listPublicNavigation("header", "de")
|
||||
|
||||
expect(navigation).toEqual([
|
||||
{
|
||||
id: "item-1",
|
||||
label: "Home",
|
||||
label: "Startseite",
|
||||
href: "/",
|
||||
children: [],
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
it("validates locale when upserting navigation item translation", async () => {
|
||||
await expect(() =>
|
||||
upsertNavigationItemTranslation({
|
||||
navigationItemId: "550e8400-e29b-41d4-a716-446655440001",
|
||||
locale: "it",
|
||||
label: "Home",
|
||||
}),
|
||||
).rejects.toThrow()
|
||||
})
|
||||
|
||||
it("validates locale when upserting page translation", async () => {
|
||||
await expect(() =>
|
||||
upsertPageTranslation({
|
||||
|
||||
Reference in New Issue
Block a user