Closed alejocg20 closed 3 years ago
You should send file,that's why it's throw that error.You just have filename
Your problem is because the Upload
Scalar is expecting the value coming in to be an Upload
instance:
https://github.com/jaydenseric/graphql-upload#class-upload
Maybe you could update your approach to use that class, but I've personally never considered testing resolvers like that. I've only ever made full GraphQL multipart requests in tests.
Closing because this is more of a request for help with your project using Jest and apparently Apollo Server; whereas this issue tracker is for raising specific and reproducible graphql-upload
bugs. Feel free to share your solution here though, whatever it ends up being :)
You should send file,that's why it's throw that error.You just have filename
Hi @alisalim17 thanks for your reply. But I didnt understand, what do you mean ?? Could you be a little be more explicit, because I am sending the FileStream promise.
Thanks
I had the same issue, I resolved changing
const fileStream = new Promise((resolve) =>
resolve({
createReadStream: () => file,
stream: file,
filename: fileName,
mimetype: 'application/png',
})
);
for
const upload = new Upload();
upload.resolve({
createReadStream: () => file,
stream: file,
filename: fileName,
encoding: '7bit',
mimetype: 'application/png',
});
I had the same issue, I resolved changing
const fileStream = new Promise((resolve) => resolve({ createReadStream: () => file, stream: file, filename: fileName, mimetype: 'application/png', }) );
for
const upload = new Upload(); upload.resolve({ createReadStream: () => file, stream: file, filename: fileName, encoding: '7bit', mimetype: 'application/png', });
Thanks @jaimepater worked
I am having the following error
Right now is only failing in the unit test, with the productive app it is working the uploading file functionality. I had the same error message with the productive app and I solved it adding the following to the package.json
I will share with you the unit test code
In addition this is the graphqlTestCall code