The config storage module (src/storage/config.ts) handles reading and writing config.yaml with project settings (model, auditor model, review enabled, presets). While the module is used in integration tests, it lacks dedicated unit tests covering edge cases like missing files, malformed YAML, unknown preset warnings, and round-trip consistency.
Relevant files:
src/storage/config.ts — the module to test (exports readConfig, writeConfig, configExists, configPath)
src/types.ts — ProjectConfig type and DEFAULT_PROJECT_CONFIG constant
test/ — place the new test file here as config.test.ts
Suggested test cases:
readConfig returns defaults when config file does not exist
writeConfig followed by readConfig round-trips correctly
readConfig handles empty YAML content
readConfig handles YAML with unknown keys (should not crash)
readConfig with review_enabled: false correctly parses boolean
readConfig with missing presets field uses defaults
configExists returns false for non-existent project path
configPath returns correct path structure
Acceptance criteria:
- New file
test/config.test.ts with at least 8 tests
- Tests use a temporary directory (cleaned up after)
- All tests pass with
npm test
The config storage module (
src/storage/config.ts) handles reading and writingconfig.yamlwith project settings (model, auditor model, review enabled, presets). While the module is used in integration tests, it lacks dedicated unit tests covering edge cases like missing files, malformed YAML, unknown preset warnings, and round-trip consistency.Relevant files:
src/storage/config.ts— the module to test (exportsreadConfig,writeConfig,configExists,configPath)src/types.ts—ProjectConfigtype andDEFAULT_PROJECT_CONFIGconstanttest/— place the new test file here asconfig.test.tsSuggested test cases:
readConfigreturns defaults when config file does not existwriteConfigfollowed byreadConfiground-trips correctlyreadConfighandles empty YAML contentreadConfighandles YAML with unknown keys (should not crash)readConfigwithreview_enabled: falsecorrectly parses booleanreadConfigwith missingpresetsfield uses defaultsconfigExistsreturns false for non-existent project pathconfigPathreturns correct path structureAcceptance criteria:
test/config.test.tswith at least 8 testsnpm test