test: refs #7058 improve test with computed properties

This commit is contained in:
Javier Segarra 2024-12-30 12:35:07 +01:00
parent 4cc895b69c
commit 2bfc6606f0
1 changed files with 19 additions and 0 deletions

View File

@ -93,4 +93,23 @@ describe('LeftMenu', () => {
vm.getRoutes();
expect(useNavigationStore().getModules).toHaveBeenCalled();
});
it('should compute pinnedModules correctly', () => {
vm.items = [
{ name: 'Item 1', isPinned: false },
{ name: 'Item 2', isPinned: true },
];
expect(vm.pinnedModules).toEqual(
new Map([['Item 2', { name: 'Item 2', isPinned: true }]])
);
});
it('should compute filteredItems correctly', () => {
vm.items = [
{ name: 'Item 1', isPinned: false },
{ name: 'Item 2', isPinned: true },
];
vm.search = 'Item 1';
expect(vm.filteredItems).toEqual([{ name: 'Item 1', isPinned: false }]);
});
});