test(mergeQueue): cover queueState, enqueue, dequeue and enqueuedByBot directly - #190
Merged
Merged
Conversation
…t directly Add __tests__/utils/mergeQueue.test.ts driving src/utils/mergeQueue.ts over MSW rather than through the tide handler: the missing-pull-request and missing-repository answers to queueState, the warn-once/reset semantics, an enqueue that returns no entry or a null payload, every classify kind, multi-error and no-message GraphQL error messages, a refused dequeue, and the enqueuedByBot login pattern. Signed-off-by: hivecommons-hive[bot] <hivecommons-hive@hive.kubestellar.io>
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. Non-outreach agents are held at ACMM L3–L5; the Hive will automatically remove the |
Contributor
|
Please add a kind label with |
This was referenced Sep 26, 2026
This was referenced Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
__tests__/utils/mergeQueue.test.ts, a direct unit test forsrc/utils/mergeQueue.ts(queueState,enqueue,dequeue,enqueuedByBot, and the privateclassify/errorMessagehelpers). Until now this module was exercised only indirectly through the tide handler tests and the bundle e2e suite, both of which drive it through fixtures that always return a populatedrepository.pullRequestand an enqueue entry with aposition.New assertions, none of which existed in either suite:
queueStatereturnsundefined— without a warning — when GitHub answersrepository.pullRequest: nullorrepository: null(src/utils/mergeQueue.ts:96, the file's only uncovered line onmain)queueStatewarns once per run on a GraphQL failure, stays quiet on the next call, and warns again afterresetMergeQueueWarnings(); a transport (non-GraphQL) failure is reported by its messageenqueuer, and noentrykey when the PR is not queuedenqueuereturns{ ok: true }with nopositionwhen the mutation returns anullentry or anullpayloadclassifykind (head_moved,already_queued,not_ready,forbidden,other) pinned to representative GitHub messageserrorMessagejoins several GraphQLerrors[].message, and falls back to the thrown error's message when none carries onedequeuesuccess and a refused dequeue (warns, returnsfalse)enqueuedByBot:github-actionscase-insensitively, any[bot]suffix, humans, look-alikes,undefinedTest-only change; no
src/ordist/changes, so no repack is needed.Closes #189
Testing
npx vitest run __tests__/utils/mergeQueue.test.ts --coverage --coverage.include=src/utils/mergeQueue.ts→ 33 passed;mergeQueue.ts | 100 | 96.66 | 100 | 100(remaining branch is theString(e)fallback for a non-Errorthrow, which octokit never produces)npx eslint __tests__/utils/mergeQueue.test.ts→ cleanChecklist
npm run allto lint and build my code (lint + tests; no build/pack output changes since only__tests__/is touched)npm run packand committeddist/— n/a, no source changeDisjoint from the open test PRs #173/#175/#177/#179/#181/#183/#185/#187: this PR adds one new file,
__tests__/utils/mergeQueue.test.ts, and touches no existing test.Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88