Skip to content

Commit

Permalink
Improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
adithyanotfound committed Nov 30, 2024
1 parent fec6c58 commit 80867c2
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion src/components/AddOn/core/AddOnEntry/AddOnEntry.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { BACKEND_URL } from 'Constant/constant';
import i18nForTest from 'utils/i18nForTest';
import { I18nextProvider } from 'react-i18next';
import userEvent from '@testing-library/user-event';
import { MockedProvider } from '@apollo/react-testing';
import { MockedProvider, wait } from '@apollo/react-testing';
import { StaticMockLink } from 'utils/StaticMockLink';
import { ADD_ON_ENTRY_MOCK } from './AddOnEntryMocks';
import { ToastContainer } from 'react-toastify';
Expand Down Expand Up @@ -189,6 +189,40 @@ describe('Testing AddOnEntry', () => {
).toBeInTheDocument();
});

it('Check if uninstalled orgs includes current org', async () => {
const props = {
id: '1',
title: 'Test Addon',
description: 'Test addon description',
createdBy: 'Test User',
component: 'string',
installed: true,
configurable: true,
modified: true,
isInstalled: true,
uninstalledOrgs: ['undefined'],
enabled: true,
getInstalledPlugins: (): { sample: string } => {
return { sample: 'sample' };
},
};

const { getByTestId } = render(
<MockedProvider addTypename={false} link={link}>
<Provider store={store}>
<BrowserRouter>
<I18nextProvider i18n={i18nForTest}>
{<AddOnEntry {...props} />}
</I18nextProvider>
</BrowserRouter>
</Provider>
</MockedProvider>,
);
await wait(100);
const btn = getByTestId('AddOnEntry_btn_install');
expect(btn.innerHTML).toMatch(/install/i);
});

test('should redirect to /orglist if orgId is undefined', async () => {
mockID = undefined;
render(
Expand Down

0 comments on commit 80867c2

Please sign in to comment.