Fixed test coverage gap where tests were only parsing JSON manually
without actually invoking the parseAndSetStructuredOutputs function.
Changes:
- Export parseAndSetStructuredOutputs for testing
- Rewrite tests to use spyOn() to mock @actions/core functions
- Add tests that actually call the function and verify:
- core.setOutput() called with correct JSON string
- core.info() called with correct field count
- Error thrown when result exists but structured_output undefined
- Error thrown when no result message exists
- Handles special characters in field names (hyphens, dots, @ symbols)
- Handles arrays and nested objects correctly
- File errors propagate correctly
All 8 tests now properly test the actual implementation with full
coverage of success and error paths.
Addresses review comment: https://github.com/anthropics/claude-code-action/pull/683#discussion_r2539770213🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>