rickub/clipublic Fork
⑂ main
Commits
⬇ Clone ▾
git clone https://git.rickub.com/rickub/cli.git
git clone ssh://git@rickub.com/rickub/cli.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

tests: pin -b - stdin for issue create and pr create #4

Closed@ogirardot wants to merge test/create-body-dash-stdin into main
Closed 5d ago.
  • @ogirardot opened this merge request · 5d ago

    What

    Closes the last open acceptance criterion of rickub/rickub#279 (criterion 3): "A test asserts -b - reaches the API as the stdin content for BOTH issue create and pr create, bite-proven by reverting the pr-create half."

    Context (why this is test-only)

    All behavior for rickub/rickub#279 already landed:

    • Criterion 1 (pr create -b - reads stdin, one shared flag definition): done — cmd/body.go is the single --body parser; runPRCreate and runIssueCreate both resolve through it.
    • Criterion 2 (PATCH title+body on the API, pr edit/issue edit driving it): done server-side in rickub/rickub MR !112 (merged 2026-09-07) and CLI-side in rickub/cli MR !1 / 8e1b39c (closes rickub/cli#7).
    • Criterion 3: the audit note on rickub/rickub#279 credited TestEveryBodyFlagUsesTheSharedResolver — but that test is STRUCTURAL (every --body flag's help is built from bodyFlagHelp); it does not assert stdin bytes reach the API. The stdin-to-API tests that existed (TestMRCommentBodyDashReadsStdin and siblings) cover the COMMENT commands only. Nothing anywhere pinned the two CREATE commands — the exact commands the issue reported (pr create -b - once stored a literal - and discarded an 8.9 KB description behind a success line).

    The change

    Two tests in cmd/body_test.go, one per create command, each asserting the posted JSON body equals the piped stdin byte for byte and naming rickub/rickub#279 on the literal-- regression assert. A shared withCreateBodyServer helper answers the right create endpoint per test (suffix-checked so a mis-routed create fails the test rather than passing as an empty capture).

    Bite-proof (the issue's own recipe)

    Reverting ONLY runPRCreate's resolveBody call (flag value used verbatim):

    --- FAIL: TestPRCreateBodyDashReadsStdin (0.00s)
        body_test.go:247: pr create -b - posted the literal "-" — rickub/rickub#279 has regressed
    

    TestIssueCreateBodyDashReadsStdin stays green in the same run — each half is independently pinned, which is what "bite-proven by reverting the pr-create half" asks. Restored, go test ./cmd/ passes in full.

    Reference: rickub/rickub#279 (cross-repo; closing happens on that issue with evidence).

Sign in to comment.