Repository navigation
Commit 6ff2a9a
Add I/O function tests: 98% coverage on run.ts (#1)
* Add I/O function tests: 52 tests, 98% statement coverage
Export Metric interface and run/runIngest/runPRCheck/postCheckRun for
testability. Mock @actions/core, @actions/github, fs, and fetch via
vi.hoisted + vi.mock + vi.stubGlobal. Tests cover all early-exit paths
in run(), ingest success/failure, all threshold breach types, missing
GITHUB_TOKEN, baseline fetch errors, Check Run success/failure/fork
degradation, and the PR head SHA selection.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Move /baseline out of Access-gated /api prefix
Cloudflare Access blocks all /api/* requests before the Worker sees them,
so the OIDC-gated baseline endpoint was returning the Access login page
(<!DOCTYPE html>) instead of JSON. The fix mirrors /ingest: mount baseline
at the root level so only the Worker's own requireOidc() middleware applies.
Route changes:
- Extract baseline handler into src/routes/baseline.ts (OIDC-gated)
- Remove baseline from src/routes/api.ts (Access-gated)
- Mount at /baseline in src/index.ts alongside /ingest
- Update Action fetch URL: /api/projects/:o/:r/baseline → /baseline/:o/:r
- Update test assertion to match new URL
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent bddd4f1 commit 6ff2a9a
6 files changed
Lines changed: 395 additions & 75 deletions
File tree
- .github/actions/report
- dist
- src
- __tests__
- src
- routes
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19656 | 19656 | | |
19657 | 19657 | | |
19658 | 19658 | | |
| 19659 | + | |
| 19660 | + | |
| 19661 | + | |
| 19662 | + | |
19659 | 19663 | | |
19660 | 19664 | | |
19661 | 19665 | | |
| |||
24752 | 24756 | | |
24753 | 24757 | | |
24754 | 24758 | | |
24755 | | - | |
| 24759 | + | |
24756 | 24760 | | |
24757 | 24761 | | |
24758 | 24762 | | |
| |||
24873 | 24877 | | |
24874 | 24878 | | |
24875 | 24879 | | |
| 24880 | + | |
| 24881 | + | |
| 24882 | + | |
| 24883 | + | |
24876 | 24884 | | |
24877 | 24885 | | |
24878 | 24886 | | |
| |||
0 commit comments