#7058 LeftMenu vitest #1153

Open
jsegarra wants to merge 18 commits from 7058_leftMenu_vitest into dev
1 changed files with 26 additions and 0 deletions
Showing only changes of commit 4618ba87fa - Show all commits

View File

@ -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 = [
{