mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-15 00:22:28 +00:00
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.
This commit is contained in:
@@ -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(() => (
|
||||
<ModelSelector
|
||||
@@ -764,9 +764,7 @@ describe('ModelSelector', () => {
|
||||
/>
|
||||
));
|
||||
|
||||
// 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 ---
|
||||
|
||||
+1
-1
@@ -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<ResourceDiscovery | null');
|
||||
expect(guestDrawerStateSource).toMatch(/createNonSuspendingQuery<\s*ResourceDiscovery \| null/);
|
||||
expect(guestDrawerStateSource).not.toContain('createResource');
|
||||
expect(guestDrawerStateSource).toContain("from './workloadTopology'");
|
||||
expect(guestDrawerStateSource).not.toContain('./infrastructureLink');
|
||||
|
||||
@@ -184,6 +184,8 @@ import resourceCorrelationPresentationSource from '@/utils/resourceCorrelationPr
|
||||
import confidencePresentationSource from '@/utils/confidencePresentation.ts?raw';
|
||||
import textPresentationSource from '@/utils/textPresentation.ts?raw';
|
||||
import messageItemSource from '@/components/AI/Chat/MessageItem.tsx?raw';
|
||||
import activeTurnStatusSource from '@/components/AI/Chat/activeTurnStatus.ts?raw';
|
||||
import toolPresentationSource from '@/components/AI/Chat/toolPresentation.ts?raw';
|
||||
import toolExecutionBlockSource from '@/components/AI/Chat/ToolExecutionBlock.tsx?raw';
|
||||
import aiChatSource from '@/components/AI/Chat/index.tsx?raw';
|
||||
import useChatSource from '@/components/AI/Chat/hooks/useChat.ts?raw';
|
||||
@@ -481,6 +483,7 @@ import patrolRunPresentationSource from '@/utils/patrolRunPresentation.ts?raw';
|
||||
import patrolSummaryPresentationSource from '@/utils/patrolSummaryPresentation.ts?raw';
|
||||
import aiCostDashboardSource from '@/components/AI/AICostDashboard.tsx?raw';
|
||||
import modelSelectorSource from '@/components/AI/Chat/ModelSelector.tsx?raw';
|
||||
import aiModelPickerSource from '@/components/shared/AIModelPicker.tsx?raw';
|
||||
import remediationStatusSource from '@/components/patrol/RemediationStatus.tsx?raw';
|
||||
import remediationPresentationSource from '@/utils/remediationPresentation.ts?raw';
|
||||
import aiChatPresentationSource from '@/utils/aiChatPresentation.ts?raw';
|
||||
@@ -2137,8 +2140,8 @@ describe('frontend resource type boundaries', () => {
|
||||
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');
|
||||
|
||||
Reference in New Issue
Block a user