mirror of
https://github.com/strapi/strapi.git
synced 2025-09-21 14:31:16 +00:00
Avoid expensive loop
This commit is contained in:
parent
0a18729fd8
commit
a1bc61c449
@ -211,20 +211,19 @@ describe('Marketplace page', () => {
|
|||||||
expect(pluginCardText).toEqual(null);
|
expect(pluginCardText).toEqual(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.only('does not show install button when plugin already installed', async () => {
|
it.only('only show install button for plugins or providers already installed', async () => {
|
||||||
render(App);
|
render(App);
|
||||||
|
|
||||||
const npmPackageCard = await screen.getAllByTestId('npm-package-card');
|
// Plugin that's already installed
|
||||||
npmPackageCard.forEach(npmPackageCard => {
|
const alreadyInstalledName = screen.getByRole('heading', { name: /^documentation/i });
|
||||||
const installedPluginName = queryByText(npmPackageCard, /^documentation$/i);
|
const alreadyInstalledCard = alreadyInstalledName.closest('[data-testid="npm-package-card"]');
|
||||||
const installedText = queryByText(npmPackageCard, /installed/i);
|
const alreadyInstalledText = queryByText(alreadyInstalledCard, /installed/i);
|
||||||
|
expect(alreadyInstalledText).toBeVisible();
|
||||||
|
|
||||||
if (installedPluginName) {
|
// Plugin that's not installed
|
||||||
// Plugin should already be installed
|
const notInstalledName = screen.getByRole('heading', { name: /^comments/i });
|
||||||
expect(installedText).toBeVisible();
|
const notInstalledCard = notInstalledName.closest('[data-testid="npm-package-card"]');
|
||||||
} else {
|
const notInstalledText = queryByText(notInstalledCard, /copy install command/i);
|
||||||
expect(installedText).toBeNull();
|
expect(notInstalledText).toBeVisible();
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user