Lambda-School-Labs/kansha-fe

View on GitHub
src/tests/__mocks__/axios.js

Summary

Maintainability
A
0 mins
Test Coverage
const mockAxios = jest.genMockFromModule('axios');

mockAxios.create = jest.fn(() => mockAxios);
mockAxios.get = jest.fn(() => Promise.resolve({ data: {} }));
mockAxios.all = jest.fn(array => Promise.all(array));
mockAxios.spread = jest.fn(callback =>
    jest.fn(arr => callback.apply(null, arr)),
);
mockAxios.delete = jest.fn(() => Promise.resolve({ data: {} }));
mockAxios.post = jest.fn(() => Promise.resolve({ data: {} }));
mockAxios.put = jest.fn(() => Promise.resolve({ data: {} }));

export default mockAxios;