mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-31 01:16:01 +02:00
test: applications list ui (#6319)
This commit is contained in:
parent
7a08a121f0
commit
ade7a88d65
@ -0,0 +1,36 @@
|
||||
import { screen } from '@testing-library/react';
|
||||
import { render } from 'utils/testRenderer';
|
||||
import { testServerRoute, testServerSetup } from 'utils/testServer';
|
||||
import { PaginatedApplicationList } from './PaginatedApplicationList';
|
||||
import { ApplicationSchema } from '../../../openapi';
|
||||
|
||||
const server = testServerSetup();
|
||||
|
||||
const setupApi = (applications: ApplicationSchema[]) => {
|
||||
testServerRoute(server, '/api/admin/metrics/applications', {
|
||||
applications,
|
||||
total: applications.length,
|
||||
});
|
||||
testServerRoute(server, '/api/admin/ui-config', {});
|
||||
};
|
||||
|
||||
test('Display applications list', async () => {
|
||||
setupApi([{ appName: 'myApp1' }, { appName: 'myApp2' }]);
|
||||
render(<PaginatedApplicationList />);
|
||||
|
||||
await screen.findByText('myApp1');
|
||||
await screen.findByText('myApp2');
|
||||
const nameColumn = screen.queryAllByText('Name')[0];
|
||||
|
||||
nameColumn.click();
|
||||
expect(window.location.href).toContain(
|
||||
'?offset=0&sortBy=appName&sortOrder=desc',
|
||||
);
|
||||
});
|
||||
|
||||
test('Display no applications', async () => {
|
||||
setupApi([]);
|
||||
render(<PaginatedApplicationList />);
|
||||
|
||||
await screen.findByText('Warning');
|
||||
});
|
@ -136,10 +136,6 @@ export const PaginatedApplicationList = () => {
|
||||
|
||||
const bodyLoadingRef = useLoading(loading);
|
||||
|
||||
if (!data) {
|
||||
return <CircularProgress variant='indeterminate' />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageContent
|
||||
|
Loading…
Reference in New Issue
Block a user