diff --git a/frontend/src/v2/components/shared/RecommendationReason.vue b/frontend/src/v2/components/shared/RecommendationReason.vue index 71da11305..00ab1b70e 100644 --- a/frontend/src/v2/components/shared/RecommendationReason.vue +++ b/frontend/src/v2/components/shared/RecommendationReason.vue @@ -49,15 +49,16 @@ const caption = computed(() => { diff --git a/frontend/src/v2/utils/similarityReasons.ts b/frontend/src/v2/utils/similarityReasons.ts index b4a9420d9..fdd6c4f4d 100644 --- a/frontend/src/v2/utils/similarityReasons.ts +++ b/frontend/src/v2/utils/similarityReasons.ts @@ -30,8 +30,8 @@ const FACET_ICONS: Record = { const TRANSLATED_FACETS: Partial> = { igdb: "recommendations.reason-igdb", top_rated: "recommendations.reason-top-rated", - // Decades arrive as the starting year ("1990"); each locale suffixes it - // its own way, so the phrasing belongs in the locale files. + // Decades arrive as the starting year ("1990"), which each locale phrases + // in its own way, so the wording belongs in the locale files. decade: "recommendations.reason-decade", }; diff --git a/frontend/src/v2/views/Home.test.ts b/frontend/src/v2/views/Home.test.ts index 39d8113e7..a0bff14e8 100644 --- a/frontend/src/v2/views/Home.test.ts +++ b/frontend/src/v2/views/Home.test.ts @@ -10,7 +10,12 @@ import { useStreamingStore, type JoinableSession } from "@/stores/streaming"; import Home from "./Home.vue"; vi.mock("vue-i18n", () => ({ - useI18n: () => ({ t: (key: string) => key }), + useI18n: () => ({ + // Renders interpolated values alongside the key, so a caption that drops + // its parameter fails here instead of passing on the bare key. + t: (key: string, params?: unknown[]) => + [key, ...(params ?? [])].filter(Boolean).join(":"), + }), })); const { getLibraryInfo, getRecommendedRoms } = vi.hoisted(() => ({ @@ -245,8 +250,8 @@ describe("Home", () => { expect(getRecommendedRoms).toHaveBeenCalledTimes(1); const caption = wrapper.find(".rec-reason"); expect(caption.text()).toBe("Super Metroid"); - expect(caption.attributes("title")).toContain( - "recommendations.because-you-played", + expect(caption.attributes("title")).toBe( + "recommendations.because-you-played:Super Metroid", ); });