Skip to content

Commit

Permalink
move timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
MonPote committed Sep 20, 2024
1 parent 70699f0 commit 295cd78
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions src/react/locations/__tests__/LocationList.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import {
screen,
waitFor,
waitForElementToBeRemoved,
within,
} from '@testing-library/react';
import { setupServer } from 'msw/node';
import { rest } from 'msw';
import {
getConfigOverlay,
getStorageConsumptionMetricsHandlers,
} from '../../../js/mock/managementClientMSWHandlers';
import {
TEST_API_BASE_URL,
mockOffsetSize,
renderWithRouterMatch,
zenkoUITestConfig,
} from '../../utils/testUtil';
import { INSTANCE_ID } from '../../actions/__tests__/utils/testUtil';
import { LocationsList } from '../LocationsList';

jest.setTimeout(30_000);

const server = setupServer(
getConfigOverlay(TEST_API_BASE_URL, INSTANCE_ID),
...getStorageConsumptionMetricsHandlers(
zenkoUITestConfig.managementEndpoint,
INSTANCE_ID,
),
rest.get(
`${TEST_API_BASE_URL}/api/v1/instance/${INSTANCE_ID}/status`,
(req, res, ctx) => res(ctx.json({})),
),
);

describe('LocationList', () => {
beforeAll(() => {
mockOffsetSize(500, 100);
server.listen({ onUnhandledRequest: 'error' });
});
afterEach(() => {
server.resetHandlers();
});
afterAll(() => {
server.close();
});
it('should disable the delete button for default location', async () => {
//S
renderWithRouterMatch(<LocationsList />);
//E
await waitForElementToBeRemoved(() => [
...screen.queryAllByText(/Loading/i),
]);
const defaultArtescaLocationRow = screen.getByRole('row', {
name: /us-east-1 Storage Service for ARTESCA/i,
});
//V
await waitFor(() => {
expect(
within(defaultArtescaLocationRow).getByRole('button', {
name: /Edit Location/i,
}),
).toBeDisabled();
});
});
});

0 comments on commit 295cd78

Please sign in to comment.