style: refs #7356 eslint format
gitea/salix-front/pipeline/pr-test This commit looks good Details

This commit is contained in:
Javier Segarra 2025-03-03 10:22:07 +01:00
parent 967848c790
commit a7af697947
1 changed files with 35 additions and 29 deletions

View File

@ -30,8 +30,8 @@ describe('CrudModel', () => {
saveFn: '',
},
});
wrapper=wrapper.wrapper;
vm=wrapper.vm;
wrapper = wrapper.wrapper;
vm = wrapper.vm;
});
beforeEach(() => {
@ -143,14 +143,14 @@ describe('CrudModel', () => {
});
it('should return true if object is empty', async () => {
dummyObj ={};
dummyObj = {};
result = vm.isEmpty(dummyObj);
expect(result).toBe(true);
});
it('should return false if object is not empty', async () => {
dummyObj = {a:1, b:2, c:3};
dummyObj = { a: 1, b: 2, c: 3 };
result = vm.isEmpty(dummyObj);
expect(result).toBe(false);
@ -164,20 +164,22 @@ describe('CrudModel', () => {
});
it('should return false if array is not empty', async () => {
dummyArray = [1,2,3];
dummyArray = [1, 2, 3];
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() });
@ -229,13 +233,15 @@ describe('CrudModel', () => {
});
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',
lastName: 'Wayne',
age: 45,
}]
},
];
await vm.saveChanges(data);