@@ -171,6 +171,31 @@ describe('DetectorsList', function () {
171171 expect ( mockDetectorsRequestErrorType ) . toHaveBeenCalled ( ) ;
172172 } ) ;
173173
174+ it ( 'can filter by assignee' , async function ( ) {
175+ const testUser = UserFixture ( { id :
'2' , email :
'[email protected] ' } ) ; 176+ const mockDetectorsRequestAssignee = MockApiClient . addMockResponse ( {
177+ url : '/organizations/org-slug/detectors/' ,
178+ body : [ MetricDetectorFixture ( { name : 'Assigned Detector' , owner : testUser . id } ) ] ,
179+ match :
[ MockApiClient . matchQuery ( { query :
'assignee:[email protected] ' } ) ] , 180+ } ) ;
181+
182+ render ( < DetectorsList /> , { organization} ) ;
183+ await screen . findByText ( 'Detector 1' ) ;
184+
185+ // Click through menus to select assignee
186+ const searchInput = await screen . findByRole ( 'combobox' , {
187+ name : 'Add a search term' ,
188+ } ) ;
189+ await userEvent . type ( searchInput , 'assignee:[email protected] ' ) ; 190+
191+ // It takes two enters. One to enter the search term, and one to submit the search.
192+ await userEvent . keyboard ( '{enter}' ) ;
193+ await userEvent . keyboard ( '{enter}' ) ;
194+
195+ await screen . findByText ( 'Assigned Detector' ) ;
196+ expect ( mockDetectorsRequestAssignee ) . toHaveBeenCalled ( ) ;
197+ } ) ;
198+
174199 it ( 'can sort the table' , async function ( ) {
175200 const mockDetectorsRequest = MockApiClient . addMockResponse ( {
176201 url : '/organizations/org-slug/detectors/' ,
0 commit comments