Skip to content

test: add tests for config.ts (read, write, parse edge cases) #58

@George-iam

Description

@George-iam

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.tsProjectConfig 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomerstestingTest improvements and coverage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions