Skip to content

test(lib): cover issues.mjs error branches + upsertMarkedComment idempotency (#322) - #337

Merged
dngioidev merged 1 commit into
mainfrom
test/322-issues-lib-error-branches
Aug 1, 2026
Merged

test(lib): cover issues.mjs error branches + upsertMarkedComment idempotency (#322)#337
dngioidev merged 1 commit into
mainfrom
test/322-issues-lib-error-branches

Conversation

@dngioidev

Copy link
Copy Markdown
Owner

Closes #322

Parent epic: #182. Test-only delivery — adds tests/lib/issues.test.mjs covering the previously-untested error/idempotency branches of plugin/scripts/lib/issues.mjs. Only buildAddSubIssue/addSubIssue were exercised before; this fills the rest via an injected fake gh (no network).

Acceptance criteria

  • AC.1 — tests cover upsertMarkedComment insert-vs-update idempotency AND a representative not-ok failure path in lib/issues.mjs.
    • Idempotency: fake gh whose 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 via markedBody/hasMarker.
    • Failure paths: getIssueNode, getSubIssues, listComments, getIssueBody, setIssueBody, plus upsertMarkedComment list/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.
  • Test-only: no source change; no defect found in issues.mjs. The fake-gh pattern matches the established one in tests/lib/board.test.mjs.

Test names tagged AC-322.1.

…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
@dngioidev
dngioidev merged commit 2b6f346 into main Aug 1, 2026
6 checks passed
@dngioidev
dngioidev deleted the test/322-issues-lib-error-branches branch August 1, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test lib/issues.mjs error branches (upsertMarkedComment + failures)

1 participant