forked from verdnatura/salix-front
Updated unit tests
This commit is contained in:
parent
f546e36693
commit
2a121b72b6
|
@ -34,10 +34,17 @@ describe('App', () => {
|
||||||
const response = {
|
const response = {
|
||||||
response: {
|
response: {
|
||||||
status: 401,
|
status: 401,
|
||||||
|
data: {
|
||||||
|
error: {
|
||||||
|
message: 'Invalid username or password',
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
expect(vm.responseError(response)).rejects.toEqual(expect.objectContaining(response));
|
expect(vm.responseError(response)).rejects.toEqual(
|
||||||
|
expect.objectContaining(response)
|
||||||
|
);
|
||||||
expect(vm.quasar.notify).toHaveBeenCalledWith(
|
expect(vm.quasar.notify).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
message: 'Invalid username or password',
|
message: 'Invalid username or password',
|
||||||
|
@ -54,10 +61,17 @@ describe('App', () => {
|
||||||
const response = {
|
const response = {
|
||||||
response: {
|
response: {
|
||||||
status: 401,
|
status: 401,
|
||||||
|
data: {
|
||||||
|
error: {
|
||||||
|
message: 'Access denied',
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
expect(vm.responseError(response)).rejects.toEqual(expect.objectContaining(response));
|
expect(vm.responseError(response)).rejects.toEqual(
|
||||||
|
expect.objectContaining(response)
|
||||||
|
);
|
||||||
expect(vm.quasar.notify).toHaveBeenCalledWith(
|
expect(vm.quasar.notify).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
message: 'Access denied',
|
message: 'Access denied',
|
||||||
|
|
|
@ -18,12 +18,12 @@ describe('ClaimDescriptorMenu', () => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('deleteClaim()', () => {
|
describe('remove()', () => {
|
||||||
it('should delete the claim', async () => {
|
it('should delete the claim', async () => {
|
||||||
vi.spyOn(axios, 'delete').mockResolvedValue({ data: true });
|
vi.spyOn(axios, 'delete').mockResolvedValue({ data: true });
|
||||||
vi.spyOn(vm.quasar, 'notify');
|
vi.spyOn(vm.quasar, 'notify');
|
||||||
|
|
||||||
await vm.deleteClaim();
|
await vm.remove();
|
||||||
|
|
||||||
expect(vm.quasar.notify).toHaveBeenCalledWith(
|
expect(vm.quasar.notify).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({ type: 'positive' })
|
expect.objectContaining({ type: 'positive' })
|
||||||
|
|
|
@ -21,7 +21,7 @@ describe('ClaimPhoto', () => {
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
vm = createWrapper(ClaimPhoto, {
|
vm = createWrapper(ClaimPhoto, {
|
||||||
global: {
|
global: {
|
||||||
stubs: ['FetchData', 'TeleportSlot', 'vue-i18n'],
|
stubs: ['FetchData', 'vue-i18n'],
|
||||||
mocks: {
|
mocks: {
|
||||||
fetch: vi.fn(),
|
fetch: vi.fn(),
|
||||||
},
|
},
|
||||||
|
@ -38,7 +38,7 @@ describe('ClaimPhoto', () => {
|
||||||
vi.spyOn(axios, 'post').mockResolvedValue({ data: true });
|
vi.spyOn(axios, 'post').mockResolvedValue({ data: true });
|
||||||
vi.spyOn(vm.quasar, 'notify');
|
vi.spyOn(vm.quasar, 'notify');
|
||||||
|
|
||||||
await vm.deleteDms(0);
|
await vm.deleteDms({ index: 0 });
|
||||||
|
|
||||||
expect(axios.post).toHaveBeenCalledWith(
|
expect(axios.post).toHaveBeenCalledWith(
|
||||||
`ClaimDms/${claimMock.claimDms[0].dmsFk}/removeFile`
|
`ClaimDms/${claimMock.claimDms[0].dmsFk}/removeFile`
|
||||||
|
@ -46,7 +46,6 @@ describe('ClaimPhoto', () => {
|
||||||
expect(vm.quasar.notify).toHaveBeenCalledWith(
|
expect(vm.quasar.notify).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({ type: 'positive' })
|
expect.objectContaining({ type: 'positive' })
|
||||||
);
|
);
|
||||||
expect(vm.claimDms).toEqual([]);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -59,8 +58,10 @@ describe('ClaimPhoto', () => {
|
||||||
expect(vm.quasar.dialog).toHaveBeenCalledWith(
|
expect(vm.quasar.dialog).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
componentProps: {
|
componentProps: {
|
||||||
message: 'This file will be deleted',
|
title: 'This file will be deleted',
|
||||||
icon: 'delete',
|
icon: 'delete',
|
||||||
|
data: { index: 1 },
|
||||||
|
promise: vm.deleteDms
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue