From 2aa7177449e289326cbfefa3277e41d80157b81e Mon Sep 17 00:00:00 2001 From: provira Date: Wed, 22 Jan 2025 07:30:28 +0100 Subject: [PATCH] fix: refs #7103 updated tests for new changes --- src/components/ui/__tests__/VnSearchbar.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/ui/__tests__/VnSearchbar.spec.js b/src/components/ui/__tests__/VnSearchbar.spec.js index 834fa2faf..6ba8a6aeb 100644 --- a/src/components/ui/__tests__/VnSearchbar.spec.js +++ b/src/components/ui/__tests__/VnSearchbar.spec.js @@ -5,7 +5,6 @@ import VnSearchbar from 'src/components/ui/VnSearchbar.vue'; describe('VnSearchbar', () => { let vm; let wrapper; - let applyFilterSpy; beforeEach(async () => { wrapper = createWrapper(VnSearchbar, { @@ -21,28 +20,29 @@ describe('VnSearchbar', () => { vm.searchText = 'Bolas de madera'; vm.arrayData.store.userParams = { staticKey: 'staticValue' }; - applyFilterSpy = vi.spyOn(vm.arrayData, 'applyFilter').mockImplementation(() => {}); + }); it('search resets pagination and applies filter', async () => { + const applyFilterSpy = vi.spyOn(vm.arrayData, 'applyFilter').mockImplementation(() => {}); const resetPaginationSpy = vi.spyOn(vm.arrayData, 'resetPagination').mockImplementation(() => {}); await vm.search(); expect(resetPaginationSpy).toHaveBeenCalled(); expect(applyFilterSpy).toHaveBeenCalledWith({ params: { search: 'Bolas de madera' }, - filter: null, }); }); it('search includes static params if searchRemoveParams is false', async () => { + const applyFilterSpy = vi.spyOn(vm.arrayData, 'applyFilter').mockImplementation(() => {}); wrapper.setProps({ searchRemoveParams: false }); await vm.$nextTick(); await vm.search(); expect(applyFilterSpy).toHaveBeenCalledWith({ params: { staticKey: 'staticValue', search: 'Bolas de madera' }, - filter: null, + filter: {skip: 0}, }); });