fix: refs #7103 updated tests for new changes
This commit is contained in:
parent
95a673a8ed
commit
2aa7177449
|
@ -5,7 +5,6 @@ import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||||
describe('VnSearchbar', () => {
|
describe('VnSearchbar', () => {
|
||||||
let vm;
|
let vm;
|
||||||
let wrapper;
|
let wrapper;
|
||||||
let applyFilterSpy;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
wrapper = createWrapper(VnSearchbar, {
|
wrapper = createWrapper(VnSearchbar, {
|
||||||
|
@ -21,28 +20,29 @@ describe('VnSearchbar', () => {
|
||||||
|
|
||||||
vm.searchText = 'Bolas de madera';
|
vm.searchText = 'Bolas de madera';
|
||||||
vm.arrayData.store.userParams = { staticKey: 'staticValue' };
|
vm.arrayData.store.userParams = { staticKey: 'staticValue' };
|
||||||
applyFilterSpy = vi.spyOn(vm.arrayData, 'applyFilter').mockImplementation(() => {});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('search resets pagination and applies filter', async () => {
|
it('search resets pagination and applies filter', async () => {
|
||||||
|
const applyFilterSpy = vi.spyOn(vm.arrayData, 'applyFilter').mockImplementation(() => {});
|
||||||
const resetPaginationSpy = vi.spyOn(vm.arrayData, 'resetPagination').mockImplementation(() => {});
|
const resetPaginationSpy = vi.spyOn(vm.arrayData, 'resetPagination').mockImplementation(() => {});
|
||||||
await vm.search();
|
await vm.search();
|
||||||
|
|
||||||
expect(resetPaginationSpy).toHaveBeenCalled();
|
expect(resetPaginationSpy).toHaveBeenCalled();
|
||||||
expect(applyFilterSpy).toHaveBeenCalledWith({
|
expect(applyFilterSpy).toHaveBeenCalledWith({
|
||||||
params: { search: 'Bolas de madera' },
|
params: { search: 'Bolas de madera' },
|
||||||
filter: null,
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('search includes static params if searchRemoveParams is false', async () => {
|
it('search includes static params if searchRemoveParams is false', async () => {
|
||||||
|
const applyFilterSpy = vi.spyOn(vm.arrayData, 'applyFilter').mockImplementation(() => {});
|
||||||
wrapper.setProps({ searchRemoveParams: false });
|
wrapper.setProps({ searchRemoveParams: false });
|
||||||
await vm.$nextTick();
|
await vm.$nextTick();
|
||||||
await vm.search();
|
await vm.search();
|
||||||
|
|
||||||
expect(applyFilterSpy).toHaveBeenCalledWith({
|
expect(applyFilterSpy).toHaveBeenCalledWith({
|
||||||
params: { staticKey: 'staticValue', search: 'Bolas de madera' },
|
params: { staticKey: 'staticValue', search: 'Bolas de madera' },
|
||||||
filter: null,
|
filter: {skip: 0},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue