[test]:Add missing tests for input validation and error wrapping in utilis.js
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 397
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 25
Description
The utility function parseAsyncAPIDocumentFromFile contains non-trivial control flow that is currently not fully covered by tests, specifically around input validation and error handling.
While the happy path (successful parsing) is exercised indirectly via higher-level tests, two important behaviors remain unverified:
Input validation logic
The function explicitly guards against invalid asyncapiFilepath values (non-string or empty/whitespace strings), but there are no direct tests asserting that these cases throw the expected error.
Error wrapping when parsing fails
When the underlying AsyncAPI parser throws, the function catches the error and rethrows a new error with a normalized message. This wrapping behavior defines part of the public error contract, but it is currently untested.
Affected file :-generator\apps\keeper\src\utils.js
Contributor guide
Research direction
Start in generator/apps/keeper/src/utils.js and inspect parseAsyncAPIDocumentFromFile, then locate the existing tests that exercise its successful parsing indirectly. Add direct coverage for non-string and empty or whitespace paths, plus the normalized error when parsing fails; done means the expected errors are asserted and the relevant test suite passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100