test(cmd/bd): pin count and omitted flag on the embedded wisp include view

GH#5565's symptom was --include-comments returning rows the count said
did not exist. Assert the include payload's comment_count matches the
streamed rows and that comments_omitted stays absent (omitempty) when
rows are present.

AC: AC-3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian Knutsen 2026-10-19 06:57:44 +00:00
commit ae43c79065

View file

@ -290,7 +290,8 @@ func TestEmbeddedShowBasicsAndJSON(t *testing.T) {
// GH#5565 / bd-u96si: direct/embedded twin of proxied
// show_wisp_comments_include_streams. --include-comments must stream the
// wisp's comments from wisp_comments.
// wisp's comments from wisp_comments, the count in the same payload must
// agree, and comments_omitted must stay omitted.
t.Run("show_json_wisp_comments_include_streams", func(t *testing.T) {
wisp := bdCreate(t, bd, dir, "Wisp stream", "--type", "task", "--ephemeral")
for i := 0; i < 2; i++ {
@ -304,6 +305,12 @@ func TestEmbeddedShowBasicsAndJSON(t *testing.T) {
if len(comments) != 2 {
t.Fatalf("comments: got %d rows, want 2 with --include-comments: %v", len(comments), m)
}
if got, _ := m["comment_count"].(float64); got != 2 {
t.Errorf("comment_count: got %v, want 2 beside the 2 streamed rows", m["comment_count"])
}
if v, present := m["comments_omitted"]; present {
t.Errorf("comments_omitted should be absent under --include-comments, got %v", v)
}
})
// ===== --short =====