1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-11-10 01:19:53 +01:00
unleash.unleash/frontend/src/component/application/ApplicationList/PaginatedApplicationList.test.tsx
Gastón Fournier abe160eb7d
feat: Unleash v7 ESM migration (#9877)
We're migrating to ESM, which will allow us to import the latest
versions of our dependencies.

Co-Authored-By: Christopher Kolstad <chriswk@getunleash.io>
2025-05-14 09:47:12 +02:00

37 lines
1.2 KiB
TypeScript

import { screen } from '@testing-library/react';
import { render } from 'utils/testRenderer';
import { testServerRoute, testServerSetup } from 'utils/testServer';
import { PaginatedApplicationList } from './PaginatedApplicationList.tsx';
import type { 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 connected', async () => {
setupApi([]);
render(<PaginatedApplicationList />);
await screen.findByText(/To connect your application to Unleash/);
});