Repository navigation
test(bundle): drive the approve plugin's evaluation arms through dist/index.js - #333
Conversation
…/index.js __tests__/bundle only reaches src/plugins/approve.ts' happy paths: on main @ 3fc21f2 the e2e run (npm run test:coverage:e2e) covers 164/193 of its lines while the unit suite covers all of them. Add approveEvaluationArms.test.ts to run the remaining arms against the fake api through the shipped bundle: - approveOnPullRequest skipping an unsupported action, approveOnReview skipping the mirrored approval review itself, and a payload without a pull request failing the run - evaluateApproval leaving a pull request alone when the branch tip has no OWNERS files although the probe did - the notifier for a pull request changing no files, for files no OWNERS file covers (listed last, sorted, nobody to suggest), and the up-to-date notifier that is neither re-posted nor edited - the updateComment, listComments and listReviews failures - approve.lgtm_acts_as_approve (/lgtm adds, /remove-lgtm withdraws) and approve.require_self_approval (the author's /approve ignored and the author excluded from the suggestion; the issue_comment refusal) plugins/approve.ts e2e lines go to 191/193; the two left are the exhaustive-switch default of effectiveKind and the `if (!hasOwners)` statement whose body is reached. Closes #332 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <quality@hive.kubestellar.io>
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will keep the |
|
🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 |
jeefy
left a comment
There was a problem hiding this comment.
14 of the 15 cases add coverage.
approveEvaluationArms.test.ts:41–43declares its owncalls(). Useconst { calls, routeOwners } = helpersFor(() => gh)instead.:300:expect(result.errors).toContain(wantErr)compares the whole::error::line. Useresult.errors.some(e => e.includes('you cannot approve your own PR')).- Drop the "/lgtm approves" row at
:253. The:254row reaches every line and branch it does (approve.ts:111–112, 231–232).
…and drop the duplicated lgtm_acts_as_approve row Signed-off-by: quality <quality@hive.kubestellar.io>
|
Addressed all three: 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 |
|
Addressed in 2ba9d37: CI is green on the new head. 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
jeefy
left a comment
There was a problem hiding this comment.
All three asks are done. On current main one case adds nothing:
- Drop
approveEvaluationArms.test.ts:134("a pull request changing no files is not approved and says so…"). #363 merged just after the first review, andapproveReviewShortCircuits.test.ts:105now reaches the same notifier path (approve.ts:289–291) and every branch it takes.
…its already reaches Signed-off-by: quality <quality@hive.kubestellar.io>
|
Addressed in 12fd915: dropped the "changing no files" notifier case; approveReviewShortCircuits.test.ts:105 (#363) reaches approve.ts:289–291 on main. 13 cases remain. 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
/kind cleanup |
Test Improvement
Adds
__tests__/bundle/approveEvaluationArms.test.ts(new file only;bundle.test.tsandhelpers.ts, which #246 edits, are untouched), driving the arms ofsrc/plugins/approve.tsthat the bundle suite never reached throughdist/index.jsagainstfakeGithub.ts:approveOnPullRequestskipping an unsupported action (closed);approveOnReviewskipping the mirrored approval review itself (reviewMarkerin the payload); apull_request_reviewpayload without a pull request failing the runevaluateApprovalleaving the pull request alone when the branch tip read for the evaluation has no OWNERS files although the probe didupdateComment,listCommentsandlistReviewsfailures (label synced first for the edit; nothing written for the reads)approve.lgtm_acts_as_approve(/lgtmadds,/remove-lgtmwithdraws) and the default where/lgtmis ignored;approve.require_self_approval(the author's/approveignored and the author excluded from the suggestion; theissue_commentrefusal insrc/issueComment/approve.ts)15 tests, ~5 s against the committed
dist/index.js.Evidence (
main@ 3fc21f2)plugins/approve.tslinesnpx vitest run --coverage)npm run test:coverage:e2e)The two lines left are
effectiveKind's exhaustive-switchdefault(236) and theif (!hasOwners)statement (505) whose body is already reached.src/e2e lines overall: 77.9 % → 79.16 %.Local runs;
test.ymlhas had nopushrun onmainsince a270568 (#329), so there is no CI artifact to cite.Related Issue
Closes #332
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5.1