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