MateusSilva ee2b19d882
test: add unit tests for parseGitHubContext and context type guards (#1404)
* test: add unit tests for parseGitHubContext and context type guards

Covers all supported webhook event types (entity and automation),
the pull_request_target normalization, isPR detection for comments
on pull requests, env-derived input defaults and parsing, and the
nine type guard functions. Raises src/github/context.ts line
coverage from 26.5% to 100%.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test: assert all env-derived inputs to close mutation testing gaps

Mutation testing (StrykerJS, 138 mutants) showed 22 surviving mutants
in the env input parsing of parseGitHubContext: fields like
trackProgress, includeFixLinks, allowedBots and the comment actor
filters were never asserted. Asserting every input field in both the
defaults and the explicit-values tests, plus covering the optional
chaining on payload.repository, brings the mutation score for
src/github/context.ts from 84.06% to 100%.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 21:16:45 -07:00
..
2025-05-19 08:32:32 -07:00