mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	test: filter by created by/author (#7307)
This commit is contained in:
		
							parent
							
								
									a91b77a7ce
								
							
						
					
					
						commit
						7df1321128
					
				| @ -25,10 +25,18 @@ const setupApi = () => { | ||||
|         features, | ||||
|         total: features.length, | ||||
|     }); | ||||
|     testServerRoute(server, '/api/admin/ui-config', {}); | ||||
|     testServerRoute(server, '/api/admin/ui-config', { | ||||
|         flags: { | ||||
|             flagCreator: true, | ||||
|         }, | ||||
|     }); | ||||
|     testServerRoute(server, '/api/admin/tags', { | ||||
|         tags: [{ type: 'backend', value: 'sdk' }], | ||||
|     }); | ||||
|     testServerRoute(server, '/api/admin/projects/default/flag-creators', [ | ||||
|         { id: 1, name: 'AuthorA' }, | ||||
|         { id: 2, name: 'AuthorB' }, | ||||
|     ]); | ||||
| }; | ||||
| 
 | ||||
| test('selects project features', async () => { | ||||
| @ -124,3 +132,32 @@ test('filters by flag type', async () => { | ||||
|     await screen.findByText('Flag type'); | ||||
|     await screen.findByText('Operational'); | ||||
| }); | ||||
| 
 | ||||
| test('filters by flag author', async () => { | ||||
|     setupApi(); | ||||
|     render( | ||||
|         <Routes> | ||||
|             <Route | ||||
|                 path={'/projects/:projectId'} | ||||
|                 element={ | ||||
|                     <ProjectFeatureToggles | ||||
|                         environments={['development', 'production']} | ||||
|                     /> | ||||
|                 } | ||||
|             /> | ||||
|         </Routes>, | ||||
|         { | ||||
|             route: '/projects/default', | ||||
|         }, | ||||
|     ); | ||||
|     const addFilter = await screen.findByText('Add Filter'); | ||||
|     fireEvent.click(addFilter); | ||||
| 
 | ||||
|     const createdBy = await screen.findByText('Created by'); | ||||
|     fireEvent.click(createdBy); | ||||
| 
 | ||||
|     const authorA = await screen.findByText('AuthorA'); | ||||
|     fireEvent.click(authorA); | ||||
| 
 | ||||
|     expect(window.location.href).toContain('createdBy=IS%3A1'); | ||||
| }); | ||||
|  | ||||
| @ -83,7 +83,11 @@ export const ProjectOverviewFilters: VFC<IProjectOverviewFilters> = ({ | ||||
|         } | ||||
| 
 | ||||
|         setAvailableFilters(availableFilters); | ||||
|     }, [JSON.stringify(tags), JSON.stringify(flagCreators)]); | ||||
|     }, [ | ||||
|         JSON.stringify(tags), | ||||
|         JSON.stringify(flagCreators), | ||||
|         flagCreatorEnabled, | ||||
|     ]); | ||||
| 
 | ||||
|     return ( | ||||
|         <Filters | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user