The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(conversations): provide English i18n templates in test mocks
Steven Enamakel634fb630a6bc
diff --git a/app/src/features/conversations/components/GoalBanner.test.tsx b/app/src/features/conversations/components/GoalBanner.test.tsxindex f5447b3e67..c426f4a3bc 100644--- a/app/src/features/conversations/components/GoalBanner.test.tsx+++ b/app/src/features/conversations/components/GoalBanner.test.tsx@@ -4,7 +4,15 @@ import { describe, expect, it, vi } from 'vitest';import type { ThreadGoalView } from '../utils/harnessState';import { formatTokens, GoalBanner } from './GoalBanner';-vi.mock('../../../lib/i18n/I18nContext', () => ({ useT: () => ({ t: (key: string) => key }) }));+// Echo i18n keys so assertions read the stable key string; the interpolated+// usage keys get their English templates so the substitution is visible.+const TEMPLATES: Record<string, string> = {+ 'conversations.goal.tokens': '{used} tokens',+ 'conversations.goal.tokensWithBudget': '{used} / {budget} tokens',+};+vi.mock('../../../lib/i18n/I18nContext', () => ({+ useT: () => ({ t: (key: string) => TEMPLATES[key] ?? key }),+}));function goal(partial: Partial<ThreadGoalView> = {}): ThreadGoalView {return {diff --git a/app/src/features/conversations/components/TodoChecklist.test.tsx b/app/src/features/conversations/components/TodoChecklist.test.tsxindex c8d0b8e8c2..71254e254b 100644--- a/app/src/features/conversations/components/TodoChecklist.test.tsx+++ b/app/src/features/conversations/components/TodoChecklist.test.tsx@@ -4,9 +4,15 @@ import { describe, expect, it, vi } from 'vitest';import type { TodoListView } from '../utils/harnessState';import { TodoChecklist } from './TodoChecklist';-// Echo i18n keys so assertions read the stable key string; interpolation-// placeholders stay in the key so the count substitution is visible.-vi.mock('../../../lib/i18n/I18nContext', () => ({ useT: () => ({ t: (key: string) => key }) }));+// Echo i18n keys so assertions read the stable key string; the one+// interpolated key gets its English template so the count substitution is+// visible.+vi.mock('../../../lib/i18n/I18nContext', () => ({+ useT: () => ({+ t: (key: string) =>+ key === 'conversations.todos.progress' ? '{completed} of {total} done' : key,+ }),+}));function list(partial: Partial<TodoListView> = {}): TodoListView {const items = partial.items ?? [@@ -42,7 +48,6 @@ describe('TodoChecklist', () => {it('shows the completed count and exposes it as data attributes', () => {render(<TodoChecklist list={list()} />);- // The key carries its placeholders; the numbers are substituted in.expect(screen.getByTestId('todo-progress').textContent).toBe('1 of 3 done');const section = screen.getByTestId('todo-checklist');expect(section.getAttribute('data-todo-completed')).toBe('1');