In FunctionCreateDialog.tsx the shape of the payload created in createFunction below
createFunction.mutate(
{
functionName: functionName.trim(),
runtime,
handler: handler.trim(),
role: role.trim(),
memorySize,
timeout,
code: zipFile , //base64 of uploaded zip
},
{
onSuccess: () => {
resetForm();
onOpenChange(false);
},
},
);
does not align with the expected shape of the working test case.
expect(mockMutate).toHaveBeenCalledWith(
{
functionName: "my-function",
runtime: "nodejs20.x",
handler: "index.handler",
role: "arn:aws:iam::000000000000:role/my-role",
memorySize: 128,
timeout: 30,
code: expect.objectContaining({ zipFile: expect.any(String) }),
},
expect.any(Object),
);
This causes an invalid request error when the zipfile is uploaded, it cannot find the uploaded code as it is uploaded as a value of code instead of zipFile which is in the child object of code.
In
FunctionCreateDialog.tsxthe shape of the payload created in createFunction belowdoes not align with the expected shape of the working test case.
This causes an invalid request error when the zipfile is uploaded, it cannot find the uploaded code as it is uploaded as a value of
codeinstead ofzipFilewhich is in the child object ofcode.