forked from verdnatura/salix-front
Reviewed-on: verdnatura/salix-front#317 Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
commit
433ca7c456
|
@ -35,6 +35,7 @@ const columns = computed(() => [
|
|||
label: t('Quantity'),
|
||||
field: (row) => row.quantity,
|
||||
sortable: true,
|
||||
default: 0,
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
|
@ -75,7 +76,6 @@ async function importLines() {
|
|||
const body = sales.map((row) => ({
|
||||
claimFk: route.params.id,
|
||||
saleFk: row.saleFk,
|
||||
quantity: row.quantity,
|
||||
}));
|
||||
|
||||
canceller = new AbortController();
|
||||
|
|
|
@ -5,7 +5,6 @@ import ClaimLinesImport from 'pages/Claim/Card/ClaimLinesImport.vue';
|
|||
describe('ClaimLinesImport', () => {
|
||||
let vm;
|
||||
|
||||
|
||||
beforeAll(() => {
|
||||
vm = createWrapper(ClaimLinesImport, {
|
||||
global: {
|
||||
|
@ -13,7 +12,7 @@ describe('ClaimLinesImport', () => {
|
|||
mocks: {
|
||||
fetch: vi.fn(),
|
||||
},
|
||||
}
|
||||
},
|
||||
}).vm;
|
||||
});
|
||||
|
||||
|
@ -26,25 +25,23 @@ describe('ClaimLinesImport', () => {
|
|||
vi.spyOn(axios, 'post').mockResolvedValue({ data: true });
|
||||
vi.spyOn(vm.quasar, 'notify');
|
||||
|
||||
vm.selected = [
|
||||
{ id: 1, saleFk: 1, claimFk: 1, quantity: 10 }
|
||||
]
|
||||
vm.selected = [{ id: 1, saleFk: 1, claimFk: 1 }];
|
||||
|
||||
vm.route.params.id = 1
|
||||
vm.route.params.id = 1;
|
||||
|
||||
await vm.importLines();
|
||||
const expectedData = [{ saleFk: 1, claimFk: 1, quantity: 10 }]
|
||||
const expectedData = [{ saleFk: 1, claimFk: 1 }];
|
||||
|
||||
expect(axios.post).toHaveBeenCalledWith('ClaimBeginnings', expectedData, {
|
||||
signal: expect.any(Object)
|
||||
})
|
||||
signal: expect.any(Object),
|
||||
});
|
||||
expect(vm.quasar.notify).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
message: 'Lines added to claim',
|
||||
type: 'positive'
|
||||
type: 'positive',
|
||||
})
|
||||
);
|
||||
expect(vm.canceller).toEqual(null)
|
||||
expect(vm.canceller).toEqual(null);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue