test(agents): align Claude static model naming#140
test(agents): align Claude static model naming#140caseyjkey wants to merge 1 commit intohappier-dev:devfrom
Conversation
WalkthroughUpdated test expectations in Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR updates two test assertions in
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| packages/agents/src/models.test.ts | Updates two test assertions to expect 'Opus 4.6' instead of 'Claude Opus 4.6' for the claude-opus-4-6 model, correctly aligning with the naming convention already used in models.ts. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["models.test.ts\ngetAgentModelConfig('claude')"] --> B["models.ts\nAGENT_MODEL_CONFIG.claude"]
B --> C["CLAUDE_STATIC_MODELS"]
C --> D["claude-opus-4-6\nname: 'Opus 4.6'"]
A --> E["Test assertion\n.toMatchObject({ name: 'Opus 4.6' })"]
D -- "matches" --> E
A2["models.test.ts\ngetAgentStaticModels('claude')"] --> F["claudeModels[0]"]
F --> G["Test assertion\n.toEqual({ name: 'Opus 4.6', ... })"]
D -- "matches" --> G
Reviews (1): Last reviewed commit: "test(agents): align Claude static model ..." | Re-trigger Greptile
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/agents/src/models.test.ts (1)
14-14: Reduce brittle copy-pinning in model-name assertionsOn Line 14 and Line 26, asserting exact label text (
'Opus 4.6') makes this test fragile to non-functional naming refreshes. Prefer asserting stable behavior (id contract + parity between returned structures) and thatnameis present.Proposed refactor
- expect(claude.staticModels?.find((model) => model.id === 'claude-opus-4-6')).toMatchObject({ - id: 'claude-opus-4-6', - name: 'Opus 4.6', - description: expect.any(String), - }); + const claudeOpusFromConfig = claude.staticModels?.find((model) => model.id === 'claude-opus-4-6'); + expect(claudeOpusFromConfig).toMatchObject({ + id: 'claude-opus-4-6', + name: expect.any(String), + description: expect.any(String), + }); @@ - expect(claudeModels[0]).toEqual({ - id: 'claude-opus-4-6', - name: 'Opus 4.6', - description: expect.any(String), - }); + expect(claudeModels[0]).toEqual({ + id: 'claude-opus-4-6', + name: expect.any(String), + description: expect.any(String), + }); + expect(claudeModels[0]?.name).toBe(claudeOpusFromConfig?.name);Based on learnings: “Content-only changes … do not require new tests. If existing tests fail because they pin copy/formatting, loosen the assertions to check stable behavior instead of exact text.”
Also applies to: 26-26
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/agents/src/models.test.ts` at line 14, The test currently pins exact model label text ("name" value 'Opus 4.6') making it brittle; update the assertions in models.test.ts to stop checking exact name text and instead assert that each model object has a non-empty name property, that the model "id" matches the expected id contract, and that the returned structures (e.g., arrays/objects under test) are consistent/parity-equal where applicable (compare ids and other stable fields rather than exact name strings). Locate the assertions referencing the "name" field (the entries with name: 'Opus 4.6') and replace exact-equality checks with presence/non-empty checks and id-based equality/parity checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/agents/src/models.test.ts`:
- Line 14: The test currently pins exact model label text ("name" value 'Opus
4.6') making it brittle; update the assertions in models.test.ts to stop
checking exact name text and instead assert that each model object has a
non-empty name property, that the model "id" matches the expected id contract,
and that the returned structures (e.g., arrays/objects under test) are
consistent/parity-equal where applicable (compare ids and other stable fields
rather than exact name strings). Locate the assertions referencing the "name"
field (the entries with name: 'Opus 4.6') and replace exact-equality checks with
presence/non-empty checks and id-based equality/parity checks.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 85ad88eb-da1c-4b85-aad8-1b8f2cc55e7c
📒 Files selected for processing (1)
packages/agents/src/models.test.ts
Summary\n- align the static-model test for the Claude catalog with the refreshed 'Opus 4.6' display name that is now returned by getAgentModelConfig\n\n## Testing\n- yarn test (fails once it reaches @happier-dev/cli-common because that workspace does not declare a
testscript; all prior packages pass)\n- node ../../node_modules/vitest/vitest.mjs run --config ./vitest.config.ts (packages/cli-common)\n- yarn workspace @happier-dev/connection-supervisor testSummary by CodeRabbit