This commit is contained in:
parent
97dfeca20d
commit
698edfbe72
|
@ -107,6 +107,7 @@ describe('useNavigationStore', () => {
|
|||
it('should add menu item correctly', () => {
|
||||
const store = useNavigationStore();
|
||||
const module = 'customer';
|
||||
const parent = [];
|
||||
const route = {
|
||||
name: 'customer',
|
||||
title: 'Customer',
|
||||
|
@ -121,8 +122,8 @@ describe('useNavigationStore', () => {
|
|||
},
|
||||
};
|
||||
|
||||
const result = store.addMenuItem(module, route, []);
|
||||
expect(result).toEqual({
|
||||
const result = store.addMenuItem(module, route, parent);
|
||||
const expectedItem = {
|
||||
children: [
|
||||
{
|
||||
icon: 'customer',
|
||||
|
@ -134,15 +135,19 @@ describe('useNavigationStore', () => {
|
|||
keyBinding: 'ctrl+shift+c',
|
||||
name: 'customer',
|
||||
title: 'globals.pageTitles.Customer',
|
||||
});
|
||||
};
|
||||
expect(result).toEqual(expectedItem);
|
||||
expect(parent.length).toBe(1);
|
||||
expect(parent).toEqual([expectedItem]);
|
||||
});
|
||||
|
||||
it('should not add menu item if condition is not met', () => {
|
||||
const store = useNavigationStore();
|
||||
const module = 'testModule';
|
||||
const route = { meta: { hidden: true, menuchildren: {} } };
|
||||
|
||||
const result = store.addMenuItem(module, route, []);
|
||||
const parent = [];
|
||||
const result = store.addMenuItem(module, route, parent);
|
||||
expect(result).toBeUndefined();
|
||||
expect(parent.length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue