Skip to content

Commit

Permalink
test: added the expect statements
Browse files Browse the repository at this point in the history
  • Loading branch information
ALOK9442 committed Jan 6, 2024
1 parent 2879452 commit 5144f89
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/components/AddOn/core/AddOnStore/AddOnStore.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ describe('Testing AddOnStore Component', () => {
waitFor(() => {
fireEvent.click(screen.getByLabelText('enable'));
});
waitFor(() => {
expect(screen.getByText('enable')).toBeInTheDocument();
});
});

test('filters by disabled plugins when "disable" radio button is selected', () => {
Expand All @@ -76,6 +79,9 @@ describe('Testing AddOnStore Component', () => {
waitFor(() => {
fireEvent.click(screen.getByLabelText('disable'));
});
waitFor(() => {
expect(screen.getByText('disable')).toBeInTheDocument();
});
});

test('searches for plugins by name', async () => {
Expand All @@ -95,6 +101,11 @@ describe('Testing AddOnStore Component', () => {
target: { value: 'examplePlugin' },
});
});

waitFor(() => {
const searchResults = screen.getAllByText('examplePlugin');
expect(searchResults.length).toBeGreaterThan(0);
});
});

test('displays a message when no search results are found', async () => {
Expand All @@ -115,6 +126,10 @@ describe('Testing AddOnStore Component', () => {
target: { value: 'nonexistentPlugin' },
});
});
waitFor(() => {
const unrelatedPlugins = screen.queryByText('nonexistentPlugin');
expect(unrelatedPlugins).toBeNull();
});
});

test('switches between "Available" and "Installed" tabs', async () => {
Expand All @@ -135,6 +150,14 @@ describe('Testing AddOnStore Component', () => {
waitFor(() => {
fireEvent.click(screen.getByText('Installed'));
});
waitFor(() => {
const installedTabContent = screen.getByText('Installed');
expect(installedTabContent).toBeInTheDocument();
});
waitFor(() => {
const availableTabContent = screen.queryByText('Available Plugin');
expect(availableTabContent).toBeNull();
});
});

test('installs a plugin when "Install" button is clicked', async () => {
Expand All @@ -155,6 +178,10 @@ describe('Testing AddOnStore Component', () => {
waitFor(() => {
fireEvent.click(screen.getByText('Install'));
});

waitFor(() => {
expect(screen.getByText('Install')).toBeInTheDocument();
});
});

test('modifies a plugin when "Modify" button is clicked', async () => {
Expand All @@ -175,6 +202,9 @@ describe('Testing AddOnStore Component', () => {
waitFor(() => {
fireEvent.click(screen.getByText('Modify'));
});
waitFor(() => {
expect(screen.getByText('Modify')).toBeInTheDocument();
});
});

test('displays the organization screen with the correct title', async () => {
Expand Down Expand Up @@ -248,6 +278,10 @@ describe('Testing AddOnStore Component', () => {
waitFor(() => {
fireEvent.click(screen.getByText('Example Plugin'));
});

waitFor(() => {
expect(screen.getByText('Example Plugin')).toBeInTheDocument();
});
});

test('renders AddOnEntry components with the correct information', async () => {
Expand Down Expand Up @@ -319,5 +353,8 @@ describe('Testing AddOnStore Component', () => {
waitFor(() => {
fireEvent.click(screen.getByText('Install'));
});
waitFor(() => {
expect(screen.getByText('Install')).toBeInTheDocument();
});
});
});

0 comments on commit 5144f89

Please sign in to comment.