Skip to content

test(remove): assert every DELETE the /remove happy paths issue; enable test/expect-expect - #512

Merged
mrbobbytables merged 1 commit into
mainfrom
quality/test-remove-assertions
Oct 21, 2026
Merged

mrbobbytables merged 1 commit into
mainfrom
quality/test-remove-assertions

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Files: __tests__/label/remove.test.ts (the two /remove happy-path tests), eslint.config.mjs (one scoped rule). No src/, dist/ or docs/ change — disjoint from #510 (src/utils/auth.ts, dist/index.js) and #511 (docs/contributing.md).

removes the specified label (line 25) and removes multiple labels (line 47) registered msw DELETE …/issues/1/labels/<name> handlers, called handleIssueComment, and asserted nothing — the only two assertion-free tests among the 1656 it/test bodies under __tests__/. On main @ 88241f4 the mutant removeLabels(octokit, context, issueNumber, toRemove.slice(0, 1)) in src/labels/remove.ts passes all 6 tests in the file, and no bundle or errorPaths scenario drives a successful multi-label /remove (bundle.test.ts:814 is the 500 arm; prefixedRemoveArms.test.ts:88-104 and errorPaths.test.ts:59-70 are error arms).

  • Each DELETE handler now carries a utils.ObserveRequest and the test awaits .called() for every requested label (two observers in the multi-label test); core.setFailed is asserted silent.
  • eslint.config.mjs enables @vitest/eslint-plugin's test/expect-expect for __tests__/**/*.test.ts, with assertFunctionNames: ['expect', 'expect*', '*.called', '*.notCalled'] so the suite's own helpers (expectRequests/expectWindow in __tests__/bundle, ObserveRequest.called()/notCalled()) count as assertions. Each whitelist entry is load-bearing: without *.called the rule also flags pullRequestOwners.test.ts:265, which asserts only via observeBranch.called(). npm run lint already runs in build-test, so the next assertion-free test is refused at lint time.

Verification (this branch, local)

  • npx vitest run __tests__/label/remove.test.ts: 6 passed
  • same, with the slice(0, 1) mutant applied to src/labels/remove.ts: removes multiple labels fails (observed request was not called within 2000ms); mutant reverted, not committed
  • npm run lint: 0 errors (the one jsdoc/check-param-names warning at src/issueComment/cc.ts:81 is pre-existing on main)
  • the rule, applied to main without the test change, reports exactly remove.test.ts:26 and :48

Related Issue

Refs #507 — the hive folded this finding into that tracker as a comment ("/remove happy-path tests (remove.test.ts:25,47) assert nothing"); this PR ticks both boxes of that comment. #507's own remaining boxes (auth.ts:24, the BRDA note) belong to #510 and #511, so the tracker stays open.


Filed by quality agent (hold-gated mode). Human review required.

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

…le test/expect-expect

remove.test.ts 'removes the specified label' and 'removes multiple labels'
registered the DELETE handlers but asserted nothing, so a /remove that
dropped all labels but the first passed the file. Each DELETE now carries an
ObserveRequest whose called() is awaited, and setFailed is asserted silent.

eslint.config.mjs turns on @vitest/eslint-plugin's test/expect-expect for
__tests__/**/*.test.ts with this suite's assertion helpers whitelisted
(expect*, *.called, *.notCalled); on main it flags exactly these two tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner October 18, 2026 23:59
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 18, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

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. Agent PRs are held at ACMM L3–L5; an outreach PR that targets a repository this hive does not manage is held at every level because it publishes project-facing communication into someone else's project.

Hive will keep the hold label until a human removes it. Operators can make a deliberate one-off release during an ACMM level change with release_level_holds=true, but level changes never release this hold automatically.

@github-actions

Copy link
Copy Markdown
Contributor

Please add a kind label with /kind feature, /kind failing-test or /kind cleanup.

This was referenced Oct 19, 2026

@mrbobbytables mrbobbytables left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review performed under the maintainer's explicit authorization to update, review, release reviewed holds, and merge eligible PRs in this cleanup.

Both /remove success cases now observe every DELETE and assert no action failure. The scoped expect-expect lint rule recognizes the existing request-observer assertion helpers.

Verified successful build-test, e2e-coverage and DCO results on head d420b9f. Any folded issue findings remain assigned to the canonical destinations in the updated scope tables.

@mrbobbytables mrbobbytables added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed hold Indicates that a PR should not merge because someone has issued a /hold command. needs-kind labels Oct 21, 2026
@mrbobbytables
mrbobbytables merged commit e3dad00 into main Oct 21, 2026
17 checks passed
@mrbobbytables
mrbobbytables deleted the quality/test-remove-assertions branch October 26, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant