Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(test): make the i18n mock honour the fallback argument\n\nCI failed with "expected 'settings.embeddings.testUnavailableCu…' to contain\n'custom endpoint'". The mock declared `t: (key: string)` and returned the raw\nkey, but the real signature is `t: (key: string, fallback?: string) => string`\n(lib/i18n/I18nContext.tsx:25) and the component supplies the tooltip text AS the\nfallback, so production renders the sentence and the test saw the key.\n\nFixed the mock rather than weakening the assertion: a mock that does not match\nthe contract it stands in for will mislead the next test written against it.\nNo product change — `t(key, fallback)` is the established pattern and the\ncomponent was already correct.\n\nVerified by reading I18nContext.tsx, not executed.\n

M3gA-Mindb17ee446767d
diff --git a/app/src/components/settings/panels/__tests__/EmbeddingsSetupModal.test.tsx b/app/src/components/settings/panels/__tests__/EmbeddingsSetupModal.test.tsx
index e518b689b3..a2c4cb8b64 100644
--- a/app/src/components/settings/panels/__tests__/EmbeddingsSetupModal.test.tsx
+++ b/app/src/components/settings/panels/__tests__/EmbeddingsSetupModal.test.tsx
@@ -26,10 +26,14 @@ import EmbeddingsSetupModal, { type EmbeddingsSetupModalProps } from '../Embeddi
*/
vi.mock('../../../../lib/i18n/I18nContext', () => ({
useT: () => ({
- t: (key: string) => {
+ // Mirror the real signature: `t: (key, fallback?) => string`
+ // (`lib/i18n/I18nContext.tsx:25`). Dropping the fallback made this mock
+ // return the raw key for any `t(key, fallback)` call, which is not what the
+ // component renders — the tooltip here is supplied as a fallback.
+ t: (key: string, fallback?: string) => {
if (key === 'settings.embeddings.testSuccess') return 'Connected: {dims} dimensions';
if (key === 'settings.embeddings.testFailed') return 'Failed: {error}';
- return key;
+ return fallback ?? key;
},
}),
}));