@@ -122,6 +122,82 @@ func TestSearch(t *testing.T) {
122122 }
123123 })
124124
125+ t .Run ("does not inject default board into search" , func (t * testing.T ) {
126+ mock := NewMockClient ()
127+ mock .GetWithPaginationResponse = & client.APIResponse {
128+ StatusCode : 200 ,
129+ Data : []any {},
130+ }
131+
132+ SetTestModeWithSDK (mock )
133+ SetTestConfig ("token" , "account" , "https://api.example.com" )
134+ cfg .Board = "default-board-id"
135+ defer resetTest ()
136+
137+ err := searchCmd .RunE (searchCmd , []string {"bug" })
138+
139+ assertExitCode (t , err , 0 )
140+ if len (mock .GetWithPaginationCalls ) != 1 {
141+ t .Fatalf ("expected 1 GetWithPagination call, got %d" , len (mock .GetWithPaginationCalls ))
142+ }
143+ path := mock .GetWithPaginationCalls [0 ].Path
144+ if path != "/cards.json?terms[]=bug" {
145+ t .Errorf ("expected no board_ids in path, got '%s'" , path )
146+ }
147+ })
148+
149+ t .Run ("tag filter works cross-board with default board set" , func (t * testing.T ) {
150+ mock := NewMockClient ()
151+ mock .GetWithPaginationResponse = & client.APIResponse {
152+ StatusCode : 200 ,
153+ Data : []any {},
154+ }
155+
156+ SetTestModeWithSDK (mock )
157+ SetTestConfig ("token" , "account" , "https://api.example.com" )
158+ cfg .Board = "default-board-id"
159+ defer resetTest ()
160+
161+ searchTag = "tag-123"
162+ err := searchCmd .RunE (searchCmd , []string {"bug" })
163+ searchTag = ""
164+
165+ assertExitCode (t , err , 0 )
166+ if len (mock .GetWithPaginationCalls ) != 1 {
167+ t .Fatalf ("expected 1 GetWithPagination call, got %d" , len (mock .GetWithPaginationCalls ))
168+ }
169+ path := mock .GetWithPaginationCalls [0 ].Path
170+ if path != "/cards.json?terms[]=bug&tag_ids[]=tag-123" {
171+ t .Errorf ("expected tag filter without board_ids, got '%s'" , path )
172+ }
173+ })
174+
175+ t .Run ("assignee filter works cross-board with default board set" , func (t * testing.T ) {
176+ mock := NewMockClient ()
177+ mock .GetWithPaginationResponse = & client.APIResponse {
178+ StatusCode : 200 ,
179+ Data : []any {},
180+ }
181+
182+ SetTestModeWithSDK (mock )
183+ SetTestConfig ("token" , "account" , "https://api.example.com" )
184+ cfg .Board = "default-board-id"
185+ defer resetTest ()
186+
187+ searchAssignee = "user-456"
188+ err := searchCmd .RunE (searchCmd , []string {"bug" })
189+ searchAssignee = ""
190+
191+ assertExitCode (t , err , 0 )
192+ if len (mock .GetWithPaginationCalls ) != 1 {
193+ t .Fatalf ("expected 1 GetWithPagination call, got %d" , len (mock .GetWithPaginationCalls ))
194+ }
195+ path := mock .GetWithPaginationCalls [0 ].Path
196+ if path != "/cards.json?terms[]=bug&assignee_ids[]=user-456" {
197+ t .Errorf ("expected assignee filter without board_ids, got '%s'" , path )
198+ }
199+ })
200+
125201 t .Run ("requires authentication" , func (t * testing.T ) {
126202 mock := NewMockClient ()
127203 SetTestModeWithSDK (mock )
0 commit comments