Skip to content
27 changes: 26 additions & 1 deletion __mocks__/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,33 @@ axios.post = axios;

axios.response = '';

axios.defaults = {
headers: {
common: {},
delete: {},
get: {},
head: {},
post: {},
put: {},
patch: {},
},
};

axios.create = jest.fn(() => axios);

axios.default = {
defaults: {},
defaults: {
headers: {
common: {},
delete: {},
get: {},
head: {},
post: {},
put: {},
patch: {},
},
},
create: jest.fn(() => axios),
};

module.exports = axios;
10 changes: 10 additions & 0 deletions __mocks__/cloudinary.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,22 @@ cloudinary.v2.uploader.upload_stream = jest.fn((options, callback) => {
callback(null, {
url: cloudinary.url,
secure_url: cloudinary.url,
public_id: 'test-public-id',
});
});
stream.on('data', noop);
return stream;
});

cloudinary.v2.uploader.upload = jest.fn((imageUrl, callback) => {
callback(null, {
url: cloudinary.url,
secure_url: cloudinary.url,
public_id: 'test-public-id',
});
});

cloudinary.url = '';
cloudinary.v2.url = jest.fn(() => cloudinary.url);

module.exports = cloudinary;
Loading
Loading