#7058 LeftMenu vitest #1153

Merged
jsegarra merged 26 commits from 7058_leftMenu_vitest into dev 2025-02-06 21:45:16 +00:00
1 changed files with 2 additions and 44 deletions
Showing only changes of commit e5940ff785 - Show all commits

View File

@ -132,55 +132,13 @@ function mount(source) {
return wrapper;
}
describe.only('getRoutes', () => {
beforeEach(() => {});
// afterEach(() => vi.clearAllMocks());
// const getRoutes = vi
// .fn()
// .mockImplementation((props, getMainRoutes, getCardRoutes) => {
// const handleRoutes = {
// main: getMainRoutes,
// card: getCardRoutes,
// };
// console.log(props.source);
// handleRoutes[props.source]();
// });
// const getMainRoutes = vi.fn();
// const getCardRoutes = vi.fn();
it('should call getCardRoutes when source is card', () => {
vm = mount('card').vm;
let props = { source: 'card' };
vi.spyOn(vm, 'getCardRoutes');
vm.getRoutes();
// getRoutes(props, getMainRoutes, getCardRoutes);
expect(vm.getCardRoutes).toHaveBeenCalled();
// expect(vm.getMainRoutes).not.toHaveBeenCalled();
});
// it.skip('should call getMainRoutes when source is main', () => {
// let props = { source: 'main' };
// getRoutes(props, getMainRoutes, getCardRoutes);
// expect(getMainRoutes).toHaveBeenCalled();
// expect(getCardRoutes).not.toHaveBeenCalled();
// });
});
describe.skip('Leftmenu as card', () => {
describe('Leftmenu as card', () => {
beforeAll(() => {
vm = mount('main').vm;
vi.spyOn(vm, 'getCardRoutes');
vi.spyOn(vm, 'getMainRoutes');
vm.getCardRoutes = vi.fn().mockReturnValue(vi.fn);
});
beforeEach(() => {
vm.getMainRoutes = vi.fn();
vm = mount('card').vm;
});
it('should get routes for card source', async () => {
vm.getRoutes();
expect(vm.getMainRoutes).toHaveBeenCalled();
});
});
describe('Leftmenu as main', () => {