Add tests for config-normalize helpers, expose internals for testability and documents bugs#118
Open
coding-creed-technologies wants to merge 1 commit intosteipete:mainfrom
Conversation
Add unit tests for configuration normalization helpers. Internal functions in `config-normalize.ts` were exported to allow direct testing of their behavior (command parsing, header handling, path normalization, and logging normalization). Three issues discovered during test generation are documented in `config-normalize.3tg.md`. Two tests reproducing these issues are currently skipped until the bugs are addressed. Also adds tests for `config-imports.ts`. Exports were added only to improve testability; no runtime behavior changes were intended.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds unit tests for configuration normalization helpers and introduces a small refactor to make several internal functions easier to test.
In
config-normalize.ts, multiple helper functions were exported so their behavior can be tested directly.While adding tests, three issues in the normalization logic were identified and documented in
config-normalize.3tg.md. Two tests that reproduce these issues are currently skipped until the bugs are addressed.Changes
config-normalize.tsto enable direct testingconfig-imports.tsconfig-normalize.3tg.mdTest Isolation
To keep the tests deterministic and independent of the runtime environment:
expandHomeare mocked where necessaryThis allows the normalization logic to be validated independently of external configuration sources.
Notes
The new exports were introduced only to improve testability and do not change runtime behavior.
The skipped tests document currently observed bugs and can be enabled once the underlying issues are fixed.
Impact
Improves test coverage for configuration normalization and helps surface edge cases in command parsing and header handling.
The documented issues also make it easier to address potential bugs in future changes.
Attribution
This contribution was generated with assistance from 3TG.
3TG is a behavior-first test generation tool for TypeScript functions that creates clean, maintainable tests and improves developer productivity.