test(lib): cover issues.mjs error branches + upsertMarkedComment idempotency (#322) - #337
Merged
Merged
Conversation
…322) Adds tests/lib/issues.test.mjs exercising the previously-untested error/idempotency branches of plugin/scripts/lib/issues.mjs via an injected fake gh (no network): - upsertMarkedComment insert-vs-update idempotency: creates (POST) when no comment carries the marker; updates (PATCH) the marked comment in place otherwise — never stacks a duplicate. Asserts the marker mechanism on the posted/patched body. - representative not-ok failure paths returning {ok:false,error} without throwing: getIssueNode, getSubIssues, listComments, getIssueBody, setIssueBody, plus upsertMarkedComment list/create/update failures. Test-only; no source change (no defect found). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SATRHKa6mDHDuirhP6QuwL
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.
Closes #322
Parent epic: #182. Test-only delivery — adds
tests/lib/issues.test.mjscovering the previously-untested error/idempotency branches ofplugin/scripts/lib/issues.mjs. OnlybuildAddSubIssue/addSubIssuewere exercised before; this fills the rest via an injected fakegh(no network).Acceptance criteria
upsertMarkedCommentinsert-vs-update idempotency AND a representative not-ok failure path inlib/issues.mjs.ghwhose comment-list returns no marked comment asserts a CREATE (POST); a list returning an existing comment carrying the marker asserts an UPDATE (PATCH) of that comment id, never a duplicate POST. The marker mechanism is asserted on the posted/patched body viamarkedBody/hasMarker.getIssueNode,getSubIssues,listComments,getIssueBody,setIssueBody, plusupsertMarkedCommentlist/create/update failures — each returns{ok:false, error:...}without throwing.Verification
npx vitest run tests/lib/issues.test.mjs— 11/11 green.pnpm verify(full suite) — 632/632 across 56 files, green.issues.mjs. The fake-gh pattern matches the established one intests/lib/board.test.mjs.Test names tagged
AC-322.1.