test: refs #7058 improve getRoutes
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Javier Segarra 2024-12-31 14:13:50 +01:00
parent 12715adbdb
commit 4618ba87fa
1 changed files with 26 additions and 0 deletions

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