mirror of
https://github.com/strapi/strapi.git
synced 2025-09-17 04:17:21 +00:00
Reset cache for all tests and remove describe
This commit is contained in:
parent
54ad17928e
commit
78b86c96c8
@ -19,9 +19,10 @@ import { createMemoryHistory } from 'history';
|
||||
import MarketPlacePage from '../index';
|
||||
import server from './server';
|
||||
|
||||
// Increase the jest timeout to accommodate long running tests
|
||||
jest.setTimeout(30000);
|
||||
const toggleNotification = jest.fn();
|
||||
jest.mock('../../../hooks/useNavigatorOnLine', () => jest.fn(() => true));
|
||||
jest.setTimeout(30000);
|
||||
jest.mock('@strapi/helper-plugin', () => ({
|
||||
...jest.requireActual('@strapi/helper-plugin'),
|
||||
useNotification: jest.fn(() => {
|
||||
@ -63,6 +64,8 @@ describe('Plugins tab', () => {
|
||||
|
||||
afterEach(() => {
|
||||
server.resetHandlers();
|
||||
// Clear the cache to isolate each test
|
||||
client.clear();
|
||||
});
|
||||
|
||||
afterAll(() => server.close());
|
||||
@ -82,11 +85,12 @@ describe('Plugins tab', () => {
|
||||
</QueryClientProvider>
|
||||
);
|
||||
|
||||
await waitForReload();
|
||||
|
||||
renderedContainer = container;
|
||||
});
|
||||
|
||||
it('renders and matches the plugin tab snapshot', async () => {
|
||||
await waitForReload();
|
||||
// Check snapshot
|
||||
expect(renderedContainer.firstChild).toMatchSnapshot();
|
||||
|
||||
@ -127,9 +131,6 @@ describe('Plugins tab', () => {
|
||||
});
|
||||
|
||||
it('shows the installed text for installed plugins', () => {
|
||||
const pluginsTab = screen.getByRole('tab', { name: /plugins/i });
|
||||
userEvent.click(pluginsTab);
|
||||
|
||||
// Plugin that's already installed
|
||||
const alreadyInstalledCard = screen
|
||||
.getAllByTestId('npm-package-card')
|
||||
@ -197,21 +198,6 @@ describe('Plugins tab', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('filter requests', () => {
|
||||
beforeAll(() => {
|
||||
// Clear cache before all the tests run
|
||||
client.clear();
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await waitForReload();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
// Clear the cache again after each test
|
||||
client.clear();
|
||||
});
|
||||
|
||||
it('filters a collection option', async () => {
|
||||
const filtersButton = screen.getByRole('button', { name: /filters/i });
|
||||
userEvent.click(filtersButton);
|
||||
@ -395,5 +381,4 @@ describe('Plugins tab', () => {
|
||||
userEvent.click(screen.getByRole('tab', { name: /plugins/i }));
|
||||
expect(collectionCards.length).toBe(2);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user