test(config): cobertura para merge-utils e env-interpolator (#52)#598
test(config): cobertura para merge-utils e env-interpolator (#52)#598nikolasdehor wants to merge 1 commit intoSynkraAI:mainfrom
Conversation
…nkraAI#52) Cobre deepMerge (13 testes), mergeAll (4 testes), isPlainObject (6 testes), interpolateString (7 testes), interpolateEnvVars (6 testes), lintEnvPatterns (5 testes) e ENV_VAR_PATTERN (3 testes).
|
@nikolasdehor is attempting to deploy a commit to the Pedro Valério Lopez's projects Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughAdds comprehensive unit test suites for env-interpolator and merge-utils config modules. Tests cover variable interpolation with defaults, recursive environment variable resolution, deep object merging, pattern detection, and immutability validation across various edge cases. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/core/config/env-interpolator.test.js`:
- Line 17: Replace the relative
require('../../../.aiox-core/core/config/env-interpolator') in
tests/core/config/env-interpolator.test.js with the repository's absolute import
for that module (use the project's absolute import root/prefix and the module
name env-interpolator), so the test imports the same module via the established
absolute path convention rather than a relative path.
In `@tests/core/config/merge-utils.test.js`:
- Line 12: Replace the relative require in the test that imports deepMerge,
mergeAll, and isPlainObject with the repository's absolute-import path: update
the require statement that currently points to
'../../../.aiox-core/core/config/merge-utils' so it imports from the
package/root absolute module path used across the repo (keeping the same
exported symbols deepMerge, mergeAll, isPlainObject) to follow the
absolute-import rule.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 67a41f17-bf34-4b27-b678-ae9735bc9f69
📒 Files selected for processing (2)
tests/core/config/env-interpolator.test.jstests/core/config/merge-utils.test.js
| interpolateEnvVars, | ||
| lintEnvPatterns, | ||
| ENV_VAR_PATTERN, | ||
| } = require('../../../.aiox-core/core/config/env-interpolator'); |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
Use absolute import path here.
Line 17 uses a relative require(...); please switch it to the project’s absolute import convention used in this repository.
As per coding guidelines, "**/*.{js,jsx,ts,tsx}: Use absolute imports instead of relative imports in all code".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/core/config/env-interpolator.test.js` at line 17, Replace the relative
require('../../../.aiox-core/core/config/env-interpolator') in
tests/core/config/env-interpolator.test.js with the repository's absolute import
for that module (use the project's absolute import root/prefix and the module
name env-interpolator), so the test imports the same module via the established
absolute path convention rather than a relative path.
|
|
||
| 'use strict'; | ||
|
|
||
| const { deepMerge, mergeAll, isPlainObject } = require('../../../.aiox-core/core/config/merge-utils'); |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
Replace relative import with absolute import.
Line 12 should follow the repository absolute-import rule instead of ../../../....
As per coding guidelines, "**/*.{js,jsx,ts,tsx}: Use absolute imports instead of relative imports in all code".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/core/config/merge-utils.test.js` at line 12, Replace the relative
require in the test that imports deepMerge, mergeAll, and isPlainObject with the
repository's absolute-import path: update the require statement that currently
points to '../../../.aiox-core/core/config/merge-utils' so it imports from the
package/root absolute module path used across the repo (keeping the same
exported symbols deepMerge, mergeAll, isPlainObject) to follow the
absolute-import rule.
Resumo
Adiciona 44 testes unitários para dois módulos core de configuração sem cobertura:
merge-utils.js (23 testes)
isPlainObject: 6 testes — objetos literais, arrays, null, primitivos, Date/RegExpdeepMerge: 13 testes — last-wins, deep merge, +append arrays, null delete, imutabilidade, 3+ níveismergeAll: 4 testes — múltiplas camadas, null/undefined, sem argsenv-interpolator.js (21 testes)
interpolateString: 7 testes — ${VAR}, ${VAR:-default}, múltiplas vars, warningsinterpolateEnvVars: 6 testes — objetos aninhados, arrays, primitivos, imutabilidadelintEnvPatterns: 5 testes — detecção em strings/arrays/deep objectsENV_VAR_PATTERN: 3 testes — regex global, captura de nome e defaultCloses #52 (parcial)
Plano de teste
npx jest tests/core/config/— 82/82 passando (inclui testes existentes)Summary by CodeRabbit