Skip to content

Commit 36b2690

Browse files
waynemsmithclaude
andcommitted
Add tests for cross-board --tag and --assignee search
Verify that --tag and --assignee filters work cross-board when a default board is configured: the request path includes tag_ids[]/assignee_ids[] but not board_ids[]. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d022b45 commit 36b2690

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

internal/commands/search_test.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,58 @@ func TestSearch(t *testing.T) {
148148
}
149149
})
150150

151+
t.Run("tag filter works cross-board with default board set", func(t *testing.T) {
152+
mock := NewMockClient()
153+
mock.GetWithPaginationResponse = &client.APIResponse{
154+
StatusCode: 200,
155+
Data: []any{},
156+
}
157+
158+
SetTestModeWithSDK(mock)
159+
SetTestConfig("token", "account", "https://api.example.com")
160+
cfg.Board = "default-board-id"
161+
defer resetTest()
162+
163+
searchTag = "tag-123"
164+
err := searchCmd.RunE(searchCmd, []string{"bug"})
165+
searchTag = ""
166+
167+
assertExitCode(t, err, 0)
168+
if len(mock.GetWithPaginationCalls) != 1 {
169+
t.Fatalf("expected 1 GetWithPagination call, got %d", len(mock.GetWithPaginationCalls))
170+
}
171+
path := mock.GetWithPaginationCalls[0].Path
172+
if path != "/cards.json?terms[]=bug&tag_ids[]=tag-123" {
173+
t.Errorf("expected tag filter without board_ids, got '%s'", path)
174+
}
175+
})
176+
177+
t.Run("assignee filter works cross-board with default board set", func(t *testing.T) {
178+
mock := NewMockClient()
179+
mock.GetWithPaginationResponse = &client.APIResponse{
180+
StatusCode: 200,
181+
Data: []any{},
182+
}
183+
184+
SetTestModeWithSDK(mock)
185+
SetTestConfig("token", "account", "https://api.example.com")
186+
cfg.Board = "default-board-id"
187+
defer resetTest()
188+
189+
searchAssignee = "user-456"
190+
err := searchCmd.RunE(searchCmd, []string{"bug"})
191+
searchAssignee = ""
192+
193+
assertExitCode(t, err, 0)
194+
if len(mock.GetWithPaginationCalls) != 1 {
195+
t.Fatalf("expected 1 GetWithPagination call, got %d", len(mock.GetWithPaginationCalls))
196+
}
197+
path := mock.GetWithPaginationCalls[0].Path
198+
if path != "/cards.json?terms[]=bug&assignee_ids[]=user-456" {
199+
t.Errorf("expected assignee filter without board_ids, got '%s'", path)
200+
}
201+
})
202+
151203
t.Run("requires authentication", func(t *testing.T) {
152204
mock := NewMockClient()
153205
SetTestModeWithSDK(mock)

0 commit comments

Comments
 (0)