Commit 3a46ff4e authored by Fernando Arias's avatar Fernando Arias

Add unit test for package_api axios call change

* Test that axios is called properly
parent 83b23942
......@@ -38,12 +38,17 @@ describe('Api', () => {
mock.onPut(expectedUrl).replyOnce(httpStatus.OK, apiResponse);
return publishPackage(
{ projectPath, name, version: 0, fileName: name, files: [{}] },
{
projectPath,
name,
version: 0,
fileName: name,
files: [new File(['zip contents'], 'bar.zip')],
},
{ status: 'hidden', select: 'package_file' },
).then(({ data }) => {
expect(data).toEqual(apiResponse);
expect(axios.put).toHaveBeenCalledWith(expectedUrl, expect.any(FormData), {
headers: { 'Content-Type': 'multipart/form-data' },
expect(axios.put).toHaveBeenCalledWith(expectedUrl, expect.any(File), {
params: { select: 'package_file', status: 'hidden' },
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment