Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(ok): drive the real lingui i18n in the consent dom suite (#4508)

Nick Gomez8a75e8c2f2dd
diff --git a/packages/app/src/components/ConsentDialogBody.dom.test.tsx b/packages/app/src/components/ConsentDialogBody.dom.test.tsx
index 0d2380f7b..9c1611bfe 100644
--- a/packages/app/src/components/ConsentDialogBody.dom.test.tsx
+++ b/packages/app/src/components/ConsentDialogBody.dom.test.tsx
@@ -1,9 +1,7 @@
import { EDITOR_LABELS } from '@inkeep/open-knowledge-core';
-import { setupI18n } from '@lingui/core';
-import * as actualLinguiMacro from '@lingui/react/macro';
+import { i18n } from '@lingui/core';
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
-import type { ReactNode } from 'react';
import { afterEach, describe, expect, test, vi } from 'vitest';
import type { ConsentStore } from '@/lib/consent-store';
import type {
@@ -11,19 +9,9 @@ import type {
OkOnboardingConfirmRequest,
OkOnboardingShowPayload,
} from '@/lib/desktop-bridge-types';
-import { renderLinguiTemplate } from '@/test-utils/lingui-mock';
+import ConsentDialogBody from './ConsentDialogBody';
-const testI18n = setupI18n({ locale: 'en', messages: { en: {}, fr: {} } });
-
-vi.doMock('@lingui/core/macro', () => ({ ...actualLinguiMacro, msg: renderLinguiTemplate }));
-
-vi.doMock('@lingui/react/macro', () => ({
- ...actualLinguiMacro,
- Trans: ({ children }: { children: ReactNode }) => <>{children}</>,
- useLingui: () => ({ t: renderLinguiTemplate, i18n: testI18n }),
-}));
-
-const { default: ConsentDialogBody } = await import('./ConsentDialogBody');
+i18n.loadAndActivate({ locale: 'en', messages: {} });
const payload: OkOnboardingShowPayload = {
pickedPath: '/project',
@@ -135,7 +123,7 @@ async function expandAdvanced() {
describe('ConsentDialogBody runtime form behavior', () => {
afterEach(() => {
cleanup();
- testI18n.activate('en');
+ i18n.activate('en');
setBridge(undefined);
vi.restoreAllMocks();
});
@@ -152,7 +140,7 @@ describe('ConsentDialogBody runtime form behavior', () => {
])(
'shows the actual probe count in $locale with truncated=$truncated',
async ({ locale, truncated, expected }) => {
- testI18n.activate(locale);
+ i18n.loadAndActivate({ locale, messages: {} });
setBridge({
...statusBridge([]),
onboarding: {
@@ -173,7 +161,7 @@ describe('ConsentDialogBody runtime form behavior', () => {
{ locale: 'en', headline: '5,000', remaining: '4,999' },
{ locale: 'fr', headline: '5\u202f000', remaining: '4\u202f999' },
])('formats the expanded remaining count in $locale', async ({ locale, headline, remaining }) => {
- testI18n.activate(locale);
+ i18n.loadAndActivate({ locale, messages: {} });
setBridge({
...statusBridge([]),
onboarding: {