This commit is contained in:
parent
967848c790
commit
a7af697947
|
@ -168,16 +168,18 @@ describe('CrudModel', () => {
|
|||
result = vm.isEmpty(dummyArray);
|
||||
|
||||
expect(result).toBe(false);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
describe('resetData()', () => {
|
||||
it('should add $index to elements in data[] and sets originalData and formData with data', async () => {
|
||||
data = [{
|
||||
data = [
|
||||
{
|
||||
name: 'Tony',
|
||||
lastName: 'Stark',
|
||||
age: 42,
|
||||
}];
|
||||
},
|
||||
];
|
||||
|
||||
vm.resetData(data);
|
||||
|
||||
|
@ -210,11 +212,13 @@ describe('CrudModel', () => {
|
|||
});
|
||||
|
||||
describe('saveChanges()', () => {
|
||||
data = [{
|
||||
data = [
|
||||
{
|
||||
name: 'Tony',
|
||||
lastName: 'Stark',
|
||||
age: 42,
|
||||
}];
|
||||
},
|
||||
];
|
||||
|
||||
it('should call saveFn if exists', async () => {
|
||||
await wrapper.setProps({ saveFn: vi.fn() });
|
||||
|
@ -231,11 +235,13 @@ describe('CrudModel', () => {
|
|||
it("should use default url if there's not saveFn", async () => {
|
||||
const postMock = vi.spyOn(axios, 'post');
|
||||
|
||||
vm.formData = [{
|
||||
vm.formData = [
|
||||
{
|
||||
name: 'Bruce',
|
||||
lastName: 'Wayne',
|
||||
age: 45,
|
||||
}]
|
||||
},
|
||||
];
|
||||
|
||||
await vm.saveChanges(data);
|
||||
|
||||
|
|
Loading…
Reference in New Issue