Skip to content

Instantly share code, notes, and snippets.

@sockol
Last active September 24, 2019 18:27
Show Gist options
  • Save sockol/bf74618c1361e35de6e7d56ce11ec05d to your computer and use it in GitHub Desktop.
Save sockol/bf74618c1361e35de6e7d56ce11ec05d to your computer and use it in GitHub Desktop.
Unit test file uploads in your Apollo GraphQL Server
addFile: async (_, options) => {
const {
file,
input
} = options;
try {
const { stream, filename, mimetype } = await file;
const s3File = await someFileStoreService.upload({ stream, filename, mimetype });
return s3File
} catch (error) {
throw new Error(error);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment