From ec63bc7b08b3ac72c4420562103f501d63f64d38 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Thu, 11 Jun 2026 11:09:25 +0100 Subject: [PATCH] test(frontend): retarget stale source-contract assertions to moved Assistant owners Four Assistant refactors (3f8525a7c, 3c3ca42c2, 29ebaf788, 1fc36a790) moved code to new owner files without updating the source-contract tests, and the hooks never run vitest, so CI has been red since Jun 4: - formatIdentifierLabel moved from MessageItem.tsx to activeTurnStatus.ts and from ToolExecutionBlock.tsx to toolPresentation.ts; the boundaries contract now asserts on the new owners (ad-hoc-regex guards on the components remain). - The model-selector empty state moved to shared AIModelPicker.tsx; the contract follows it and keeps the no-hardcoded-copy guard on both. - useGuestDrawerState's discovery query was prettier-wrapped across lines; the workloads contract now uses a whitespace-tolerant toMatch. - ModelSelector's empty-name fallback deliberately renders a humanized 'Anthropic: Claude Test' route label since the OpenCode alignment; the test expectation now matches the shipped behavior. --- .../AI/Chat/__tests__/ModelSelector.test.tsx | 6 ++---- .../WorkloadsSurface.performance.contract.test.tsx | 2 +- .../__tests__/frontendResourceTypeBoundaries.test.ts | 10 +++++++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/frontend-modern/src/components/AI/Chat/__tests__/ModelSelector.test.tsx b/frontend-modern/src/components/AI/Chat/__tests__/ModelSelector.test.tsx index e4a52f9ee0..c921292d31 100644 --- a/frontend-modern/src/components/AI/Chat/__tests__/ModelSelector.test.tsx +++ b/frontend-modern/src/components/AI/Chat/__tests__/ModelSelector.test.tsx @@ -754,7 +754,7 @@ describe('ModelSelector', () => { // --- Model name display --- - it('falls back to model ID segment when name is not provided', () => { + it('falls back to a humanized provider route label when name is not provided', () => { const models = [makeModel({ id: 'anthropic:claude-test', name: '', notable: true })]; render(() => ( { /> )); - // selectedLabel should use id.split(':').pop() when name is empty but match exists - // Actually, empty name returns falsy, so it falls to id.split(':').pop() - expect(screen.getByText('claude-test')).toBeInTheDocument(); + expect(screen.getByText('Anthropic: Claude Test')).toBeInTheDocument(); }); // --- Empty models list --- diff --git a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx index b6e6bb1556..fbc9da620b 100644 --- a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx +++ b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx @@ -1263,7 +1263,7 @@ describe('Workloads performance contract', () => { expect(guestDrawerStateSource).not.toContain('buildInfrastructureHrefForWorkload'); expect(guestDrawerStateSource).not.toContain("from '@/routing/resourceLinks'"); expect(guestDrawerStateSource).toContain("from '@/hooks/createNonSuspendingQuery'"); - expect(guestDrawerStateSource).toContain('createNonSuspendingQuery { expect(k8sDeploymentsDrawerSource).not.toContain( "const normalize = (value?: string | null) => (value || '').trim();", ); - expect(messageItemSource).toContain('formatIdentifierLabel'); - expect(toolExecutionBlockSource).toContain('formatIdentifierLabel'); + expect(activeTurnStatusSource).toContain('formatIdentifierLabel'); + expect(toolPresentationSource).toContain('formatIdentifierLabel'); expect(aiChatSource).toContain('formatIdentifierLabel'); expect(patrolStatusBarSource).toContain('formatTriggerReason'); expect(findingsPanelSource).toContain('formatIdentifierLabel'); @@ -3718,7 +3721,8 @@ describe('frontend resource type boundaries', () => { expect(aiCostPresentationSource).toContain( 'export function getAICostExportHistoryErrorMessage', ); - expect(modelSelectorSource).toContain('AI_CHAT_MODEL_SELECTOR_EMPTY_STATE'); + expect(aiModelPickerSource).toContain('AI_CHAT_MODEL_SELECTOR_EMPTY_STATE'); + expect(aiModelPickerSource).not.toContain('No matching models.'); expect(modelSelectorSource).not.toContain('No matching models.'); expect(aiChatPresentationSource).toContain('export const AI_CHAT_MODEL_SELECTOR_EMPTY_STATE'); expect(aiChatPresentationSource).toContain('export const AI_CHAT_SESSION_EMPTY_STATE');