fix: refs #7103 updated tests for new changes

This commit is contained in:
PAU ROVIRA ROSALENY 2025-01-22 07:30:28 +01:00
parent 95a673a8ed
commit 2aa7177449
1 changed files with 4 additions and 4 deletions

View File

@ -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},
});
});