test: refs #7058 improve getRoutes
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
12715adbdb
commit
4618ba87fa
|
@ -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 = [
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue