From 02c7452782f34c4d66f21283627a1b69d6add7ec Mon Sep 17 00:00:00 2001 From: Awais Ansari Date: Sat, 21 Sep 2024 18:26:45 +0500 Subject: [PATCH] test: added test for MainAppSlot --- .../MainAppSlot/MainAppSlot.test.jsx | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/plugin-slots/MainAppSlot/MainAppSlot.test.jsx diff --git a/src/plugin-slots/MainAppSlot/MainAppSlot.test.jsx b/src/plugin-slots/MainAppSlot/MainAppSlot.test.jsx new file mode 100644 index 000000000..f5262d81e --- /dev/null +++ b/src/plugin-slots/MainAppSlot/MainAppSlot.test.jsx @@ -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(); + }); + + it('renders a PluginSlot component', () => { + render(); + expect(PluginSlot).toHaveBeenCalled(); + }); + + it('passes the correct id prop to PluginSlot', () => { + render(); + expect(PluginSlot).toHaveBeenCalledWith({ id: 'main_app_slot' }, {}); + }); + + it('does not render any children', () => { + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); +});