mirror of
https://github.com/strapi/strapi.git
synced 2025-09-21 06:22:30 +00:00
Fix tests
This commit is contained in:
parent
a1bc61c449
commit
f9adb61056
@ -2699,6 +2699,7 @@ exports[`Marketplace page renders and matches the provider tab snapshot 1`] = `
|
||||
>
|
||||
<div
|
||||
class="c38 c39"
|
||||
data-testid="npm-package-card"
|
||||
height="100%"
|
||||
>
|
||||
<div
|
||||
@ -2830,6 +2831,7 @@ exports[`Marketplace page renders and matches the provider tab snapshot 1`] = `
|
||||
>
|
||||
<div
|
||||
class="c38 c39"
|
||||
data-testid="npm-package-card"
|
||||
height="100%"
|
||||
>
|
||||
<div
|
||||
@ -2961,6 +2963,7 @@ exports[`Marketplace page renders and matches the provider tab snapshot 1`] = `
|
||||
>
|
||||
<div
|
||||
class="c38 c39"
|
||||
data-testid="npm-package-card"
|
||||
height="100%"
|
||||
>
|
||||
<div
|
||||
@ -3082,6 +3085,7 @@ exports[`Marketplace page renders and matches the provider tab snapshot 1`] = `
|
||||
>
|
||||
<div
|
||||
class="c38 c39"
|
||||
data-testid="npm-package-card"
|
||||
height="100%"
|
||||
>
|
||||
<div
|
||||
@ -3213,6 +3217,7 @@ exports[`Marketplace page renders and matches the provider tab snapshot 1`] = `
|
||||
>
|
||||
<div
|
||||
class="c38 c39"
|
||||
data-testid="npm-package-card"
|
||||
height="100%"
|
||||
>
|
||||
<div
|
||||
@ -3344,6 +3349,7 @@ exports[`Marketplace page renders and matches the provider tab snapshot 1`] = `
|
||||
>
|
||||
<div
|
||||
class="c38 c39"
|
||||
data-testid="npm-package-card"
|
||||
height="100%"
|
||||
>
|
||||
<div
|
||||
@ -3475,6 +3481,7 @@ exports[`Marketplace page renders and matches the provider tab snapshot 1`] = `
|
||||
>
|
||||
<div
|
||||
class="c38 c39"
|
||||
data-testid="npm-package-card"
|
||||
height="100%"
|
||||
>
|
||||
<div
|
||||
@ -3606,6 +3613,7 @@ exports[`Marketplace page renders and matches the provider tab snapshot 1`] = `
|
||||
>
|
||||
<div
|
||||
class="c38 c39"
|
||||
data-testid="npm-package-card"
|
||||
height="100%"
|
||||
>
|
||||
<div
|
||||
@ -3737,6 +3745,7 @@ exports[`Marketplace page renders and matches the provider tab snapshot 1`] = `
|
||||
>
|
||||
<div
|
||||
class="c38 c39"
|
||||
data-testid="npm-package-card"
|
||||
height="100%"
|
||||
>
|
||||
<div
|
||||
|
@ -64,7 +64,7 @@ describe('Marketplace page', () => {
|
||||
|
||||
afterAll(() => server.close());
|
||||
|
||||
it.only('renders and matches the plugin tab snapshot', async () => {
|
||||
it('renders and matches the plugin tab snapshot', async () => {
|
||||
const { container, getByTestId, getByRole } = render(App);
|
||||
await waitForElementToBeRemoved(() => getByTestId('loader'));
|
||||
await waitFor(() => expect(getByRole('heading', { name: /marketplace/i })).toBeInTheDocument());
|
||||
@ -143,7 +143,11 @@ describe('Marketplace page', () => {
|
||||
|
||||
it('handles production environment', () => {
|
||||
// Simulate production environment
|
||||
useAppInfos.mockImplementation(() => ({ autoReload: false, dependencies: {}, useYarn: true }));
|
||||
useAppInfos.mockImplementationOnce(() => ({
|
||||
autoReload: false,
|
||||
dependencies: {},
|
||||
useYarn: true,
|
||||
}));
|
||||
const { queryByText } = render(App);
|
||||
|
||||
// Should display notification
|
||||
@ -211,8 +215,10 @@ describe('Marketplace page', () => {
|
||||
expect(pluginCardText).toEqual(null);
|
||||
});
|
||||
|
||||
it.only('only show install button for plugins or providers already installed', async () => {
|
||||
it('only show install button for plugins already installed', async () => {
|
||||
render(App);
|
||||
const pluginsTab = screen.getByRole('tab', { name: /plugins/i });
|
||||
fireEvent.click(pluginsTab);
|
||||
|
||||
// Plugin that's already installed
|
||||
const alreadyInstalledName = screen.getByRole('heading', { name: /^documentation/i });
|
||||
@ -226,4 +232,23 @@ describe('Marketplace page', () => {
|
||||
const notInstalledText = queryByText(notInstalledCard, /copy install command/i);
|
||||
expect(notInstalledText).toBeVisible();
|
||||
});
|
||||
|
||||
it('only show install button for providers already installed', async () => {
|
||||
// Open providers tab
|
||||
render(App);
|
||||
const providersTab = screen.getByRole('tab', { name: /providers/i });
|
||||
fireEvent.click(providersTab);
|
||||
|
||||
// Provider that's already installed
|
||||
const alreadyInstalledName = screen.getByRole('heading', { name: /cloudinary/i });
|
||||
const alreadyInstalledCard = alreadyInstalledName.closest('[data-testid="npm-package-card"]');
|
||||
const alreadyInstalledText = queryByText(alreadyInstalledCard, /installed/i);
|
||||
expect(alreadyInstalledText).toBeVisible();
|
||||
|
||||
// Provider that's not installed
|
||||
const notInstalledName = screen.getByRole('heading', { name: /rackspace/i });
|
||||
const notInstalledCard = notInstalledName.closest('[data-testid="npm-package-card"]');
|
||||
const notInstalledText = queryByText(notInstalledCard, /copy install command/i);
|
||||
expect(notInstalledText).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user