forked from verdnatura/salix-front
test: refs #8039 axios not notify
This commit is contained in:
parent
8478d89183
commit
c69f7af390
|
@ -36,8 +36,6 @@ describe('Axios boot', () => {
|
||||||
|
|
||||||
describe('onResponseError()', async () => {
|
describe('onResponseError()', async () => {
|
||||||
it('should call to the Notify plugin with a message error for an status code "500"', async () => {
|
it('should call to the Notify plugin with a message error for an status code "500"', async () => {
|
||||||
Notify.create = vi.fn();
|
|
||||||
|
|
||||||
const error = {
|
const error = {
|
||||||
response: {
|
response: {
|
||||||
status: 500,
|
status: 500,
|
||||||
|
@ -45,19 +43,10 @@ describe('Axios boot', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = onResponseError(error);
|
const result = onResponseError(error);
|
||||||
|
|
||||||
expect(result).rejects.toEqual(expect.objectContaining(error));
|
expect(result).rejects.toEqual(expect.objectContaining(error));
|
||||||
expect(Notify.create).toHaveBeenCalledWith(
|
|
||||||
expect.objectContaining({
|
|
||||||
message: 'An internal server error has ocurred',
|
|
||||||
type: 'negative',
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call to the Notify plugin with a message from the response property', async () => {
|
it('should call to the Notify plugin with a message from the response property', async () => {
|
||||||
Notify.create = vi.fn();
|
|
||||||
|
|
||||||
const error = {
|
const error = {
|
||||||
response: {
|
response: {
|
||||||
status: 401,
|
status: 401,
|
||||||
|
@ -70,14 +59,7 @@ describe('Axios boot', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = onResponseError(error);
|
const result = onResponseError(error);
|
||||||
|
|
||||||
expect(result).rejects.toEqual(expect.objectContaining(error));
|
expect(result).rejects.toEqual(expect.objectContaining(error));
|
||||||
expect(Notify.create).toHaveBeenCalledWith(
|
|
||||||
expect.objectContaining({
|
|
||||||
message: 'Invalid user or password',
|
|
||||||
type: 'negative',
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue