#8113 create arrayDataStore map #979
|
@ -341,7 +341,6 @@ const openTab = (id) =>
|
|||
:row-click="({ id }) => openTab(id)"
|
||||
:disable-option="{ card: true }"
|
||||
:user-params="{ from, to, scopeDays: 1 }"
|
||||
:limit="3"
|
||||
>
|
||||
<template #top-left>
|
||||
<QBtn
|
||||
|
|
|
@ -4,7 +4,11 @@ import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
|||
|
||||
describe('VnPaginate', () => {
|
||||
const expectedUrl = '/api/customers';
|
||||
|
||||
const defaultData = [
|
||||
{ id: 1, name: 'Tony Stark' },
|
||||
{ id: 2, name: 'Jessica Jones' },
|
||||
{ id: 3, name: 'Bruce Wayne' },
|
||||
];
|
||||
let vm;
|
||||
beforeAll(() => {
|
||||
const options = {
|
||||
|
@ -28,11 +32,7 @@ describe('VnPaginate', () => {
|
|||
describe('paginate()', () => {
|
||||
it('should call to the paginate() method and set the data on the rows property', async () => {
|
||||
vi.spyOn(vm.arrayData, 'loadMore');
|
||||
vm.store.data = [
|
||||
{ id: 1, name: 'Tony Stark' },
|
||||
{ id: 2, name: 'Jessica Jones' },
|
||||
{ id: 3, name: 'Bruce Wayne' },
|
||||
];
|
||||
vm.store.data = defaultData;
|
||||
|
||||
await vm.paginate();
|
||||
|
||||
|
@ -42,26 +42,25 @@ describe('VnPaginate', () => {
|
|||
|
||||
it('should call to the paginate() method and then call it again to paginate', async () => {
|
||||
vi.spyOn(axios, 'get').mockResolvedValue({
|
||||
data: [
|
||||
{ id: 1, name: 'Tony Stark' },
|
||||
{ id: 2, name: 'Jessica Jones' },
|
||||
{ id: 3, name: 'Bruce Wayne' },
|
||||
],
|
||||
data: defaultData,
|
||||
});
|
||||
vm.store.hasMoreData = true;
|
||||
await vm.$nextTick();
|
||||
|
||||
vm.store.data = [
|
||||
{ id: 1, name: 'Tony Stark' },
|
||||
{ id: 2, name: 'Jessica Jones' },
|
||||
{ id: 3, name: 'Bruce Wayne' },
|
||||
];
|
||||
vm.store.data = defaultData;
|
||||
|
||||
await vm.paginate();
|
||||
|
||||
expect(vm.store.skip).toEqual(3);
|
||||
expect(vm.store.data.length).toEqual(6);
|
||||
|
||||
vi.spyOn(axios, 'get').mockResolvedValue({
|
||||
|
||||
data: [
|
||||
{ id: 4, name: 'Peter Parker' },
|
||||
{ id: 5, name: 'Clark Kent' },
|
||||
{ id: 6, name: 'Barry Allen' },
|
||||
],
|
||||
});
|
||||
await vm.paginate();
|
||||
|
||||
expect(vm.store.skip).toEqual(6);
|
||||
|
@ -85,11 +84,7 @@ describe('VnPaginate', () => {
|
|||
|
||||
const index = 1;
|
||||
const done = vi.fn();
|
||||
vm.store.data = [
|
||||
{ id: 1, name: 'Tony Stark' },
|
||||
{ id: 2, name: 'Jessica Jones' },
|
||||
{ id: 3, name: 'Bruce Wayne' },
|
||||
];
|
||||
vm.store.data = defaultData;
|
||||
|
||||
await vm.onLoad(index, done);
|
||||
|
||||
|
@ -105,11 +100,7 @@ describe('VnPaginate', () => {
|
|||
],
|
||||
});
|
||||
|
||||
vm.store.data = [
|
||||
{ id: 1, name: 'Tony Stark' },
|
||||
{ id: 2, name: 'Jessica Jones' },
|
||||
{ id: 3, name: 'Bruce Wayne' },
|
||||
];
|
||||
vm.store.data = defaultData;
|
||||
|
||||
expect(vm.pagination.page).toEqual(1);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Si son los mismos registros ahora no los va a volver a añadir.