tests: pin -b - stdin for issue create and pr create #4
test/create-body-dash-stdin into main- @ogirardot opened this merge request · 5d agoedited
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 BOTHissue createandpr 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.gois the single--bodyparser;runPRCreateandrunIssueCreateboth resolve through it. - Criterion 2 (PATCH title+body on the API,
pr edit/issue editdriving 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--bodyflag's help is built frombodyFlagHelp); it does not assert stdin bytes reach the API. The stdin-to-API tests that existed (TestMRCommentBodyDashReadsStdinand 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 JSONbodyequals the piped stdin byte for byte and naming rickub/rickub#279 on the literal--regression assert. A sharedwithCreateBodyServerhelper 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'sresolveBodycall (flag value used verbatim):--- FAIL: TestPRCreateBodyDashReadsStdin (0.00s) body_test.go:247: pr create -b - posted the literal "-" — rickub/rickub#279 has regressedTestIssueCreateBodyDashReadsStdinstays 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).
- Criterion 1 (
Sign in to comment.