diff --git a/src/components/__tests__/Leftmenu.spec.js b/src/components/__tests__/Leftmenu.spec.js index 874c3c81b..6adabedd5 100644 --- a/src/components/__tests__/Leftmenu.spec.js +++ b/src/components/__tests__/Leftmenu.spec.js @@ -133,7 +133,33 @@ describe('Leftmenu as main', () => { beforeAll(() => { vm = mount('main').vm; }); + // WIP + it.skip('should call getMainRoutes when source is main', () => { + vm.getRoutes = vi + .fn() + .mockImplementation((props, getMainRoutes, getCardRoutes) => { + const handleRoutes = { + main: getMainRoutes, + card: getCardRoutes, + }; + console.log(props.source); + handleRoutes[props.source](); + }); + let props = { source: 'main' }; + const getMainRoutes = vi.fn(); + const getCardRoutes = vi.fn(); + vm.getRoutes(props, getMainRoutes, getCardRoutes); + + expect(getMainRoutes).toHaveBeenCalled(); + expect(getCardRoutes).not.toHaveBeenCalled(); + props = { source: 'card' }; + + vm.getRoutes(props, getMainRoutes, getCardRoutes); + + expect(getCardRoutes).toHaveBeenCalled(); + expect(getMainRoutes).not.toHaveBeenCalled(); + }); it('should return a proper formated object with two child items', async () => { const expectedMenuItem = [ {