Skip to content

Commit

Permalink
test: added test for MainAppSlot
Browse files Browse the repository at this point in the history
  • Loading branch information
awais-ansari committed Sep 21, 2024
1 parent 3cea87c commit 02c7452
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/plugin-slots/MainAppSlot/MainAppSlot.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { PluginSlot } from '@openedx/frontend-plugin-framework';
import { render } from '@testing-library/react';

import MainAppSlot from './index';

jest.mock('@openedx/frontend-plugin-framework', () => ({
PluginSlot: jest.fn(() => null),
}));

describe('MainAppSlot', () => {
it('renders without crashing', () => {
render(<MainAppSlot />);
});

it('renders a PluginSlot component', () => {
render(<MainAppSlot />);
expect(PluginSlot).toHaveBeenCalled();
});

it('passes the correct id prop to PluginSlot', () => {
render(<MainAppSlot />);
expect(PluginSlot).toHaveBeenCalledWith({ id: 'main_app_slot' }, {});
});

it('does not render any children', () => {
const { container } = render(<MainAppSlot />);
expect(container.firstChild).toBeNull();
});
});

0 comments on commit 02c7452

Please # to comment.