test(config): add unit tests for config utility modules#314
test(config): add unit tests for config utility modules#314zbigniewsobiecki merged 1 commit intodevfrom
Conversation
|
🔍 Reviewing PR... |
aaight
left a comment
There was a problem hiding this comment.
Summary
LGTM — well-structured unit tests for 6 config utility modules. Tests are correct, follow existing patterns (hintConfig.test.ts), and CI is green.
Code Issues
Should Fix
- tests/unit/config/customModels.test.ts:79 — The test "all models have knowledge cutoff date" uses a conditional
if (model.knowledgeCutoff)that only validates the format when the field exists, but doesn't assert every model actually has the field. The test name implies it verifies presence, but it would silently pass for models missingknowledgeCutoff. Consider usingexpect(model.knowledgeCutoff).toBeDefined()before the regex check — or rename the test to "knowledge cutoff dates have valid format" to match what it actually tests.
Everything else looks solid: mock patterns are correct, edge cases (0%/50%/100% progress bars, rounding, empty strings) are well-covered, Object.assign usage for adding status codes to errors is clean, and the tests accurately reflect the source implementations.
| expect(typeof model.features.functionCalling).toBe('boolean'); | ||
| } | ||
| }); | ||
| }); |
There was a problem hiding this comment.
The conditional if (model.knowledgeCutoff) means this test silently passes for models without the field — the test name ("all models have knowledge cutoff date") implies it verifies presence. Either add expect(model.knowledgeCutoff).toBeDefined() before the regex, or rename to "knowledge cutoff dates have valid format" to match the actual behavior.
Summary
Changes
New Test Files
getRateLimitForModel()with exact match, prefix match, and fallback behaviorgetRetryConfig()structure,shouldRetry()logic with retryable/stream/non-retryable errors, and callback logginggetCompactionConfig()with implementation vs. other agent thresholds, andonCompaction()callback that clears read trackinggetStatusUpdateConfig()(debug agent disabled),formatStatusMessage()progress bar rendering, and task countsestimateTokens()correctness andREVIEW_FILE_CONTENT_TOKEN_LIMITconstantCUSTOM_MODELSarray structure, pricing, features, and model specificationsTest Coverage
Test Patterns
hintConfig.test.tspatternsObject.assign()instead ofas anyto avoid lint warningsCloses https://trello.com/c/69938031828499e77dfe74ad