feat: #7103 created test for VnSearchbar #1256

Merged
provira merged 14 commits from 7103-testVnSearchbar into dev 2025-01-22 11:15:21 +00:00
1 changed files with 4 additions and 4 deletions
Showing only changes of commit 2aa7177449 - Show all commits

View File

@ -5,7 +5,6 @@ import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
describe('VnSearchbar', () => {
provira marked this conversation as resolved Outdated

porque functions?

porque functions?
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(() => {});
});
provira marked this conversation as resolved Outdated

Promise.resolve(), vacio?

Promise.resolve(), vacio?
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},
});
});