Skip to content

Commit

Permalink
Fix .mjs imports.
Browse files Browse the repository at this point in the history
Fixes #40.
  • Loading branch information
jaydenseric committed Jan 29, 2018
1 parent b703522 commit ad63db9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# apollo-upload-server changelog

## Next

* Correct imports for vanilla Node.js `--experimental-modules` and `.mjs` support, fixing [#40](https://github.com/jaydenseric/apollo-upload-server/issues/40).

## 4.0.0

* Updated dependencies.
Expand Down
24 changes: 12 additions & 12 deletions src/test.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createReadStream } from 'fs'
import fs from 'fs'
import test from 'ava'
import Koa from 'koa'
import getPort from 'get-port'
Expand Down Expand Up @@ -52,7 +52,7 @@ test('Single file.', async t => {
)

body.append('map', JSON.stringify({ '1': ['variables.file'] }))
body.append('1', createReadStream(TEST_FILE_PATH))
body.append('1', fs.createReadStream(TEST_FILE_PATH))

await got(`http://localhost:${port}`, { body })

Expand Down Expand Up @@ -88,7 +88,7 @@ test('Deduped files.', async t => {
JSON.stringify({ '1': ['variables.files.0', 'variables.files.1'] })
)

body.append('1', createReadStream(TEST_FILE_PATH))
body.append('1', fs.createReadStream(TEST_FILE_PATH))

await got(`http://localhost:${port}`, { body })

Expand Down Expand Up @@ -119,8 +119,8 @@ test('Extraneous file.', async t => {
)

body.append('map', JSON.stringify({ '1': ['variables.file'] }))
body.append('1', createReadStream(TEST_FILE_PATH))
body.append('2', createReadStream(TEST_FILE_PATH))
body.append('1', fs.createReadStream(TEST_FILE_PATH))
body.append('2', fs.createReadStream(TEST_FILE_PATH))

await got(`http://localhost:${port}`, { body })

Expand Down Expand Up @@ -194,8 +194,8 @@ test('Exceed max files.', async t => {
})
)

body.append('1', createReadStream(TEST_FILE_PATH))
body.append('2', createReadStream(TEST_FILE_PATH))
body.append('1', fs.createReadStream(TEST_FILE_PATH))
body.append('2', fs.createReadStream(TEST_FILE_PATH))

await got(`http://localhost:${port}`, { body })

Expand Down Expand Up @@ -238,9 +238,9 @@ test('Exceed max files with extraneous files intersperced.', async t => {
})
)

body.append('1', createReadStream(TEST_FILE_PATH))
body.append('extraneous', createReadStream(TEST_FILE_PATH))
body.append('2', createReadStream(TEST_FILE_PATH))
body.append('1', fs.createReadStream(TEST_FILE_PATH))
body.append('extraneous', fs.createReadStream(TEST_FILE_PATH))
body.append('2', fs.createReadStream(TEST_FILE_PATH))

await got(`http://localhost:${port}`, { body })

Expand Down Expand Up @@ -282,7 +282,7 @@ test('Misorder “map” before “operations”.', async t => {
})
)

body.append('1', createReadStream(TEST_FILE_PATH))
body.append('1', fs.createReadStream(TEST_FILE_PATH))

await got(`http://localhost:${port}`, { body })

Expand Down Expand Up @@ -317,7 +317,7 @@ test('Misorder files before “map”.', async t => {
})
)

body.append('1', createReadStream(TEST_FILE_PATH))
body.append('1', fs.createReadStream(TEST_FILE_PATH))

body.append(
'map',
Expand Down
4 changes: 2 additions & 2 deletions src/types.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GraphQLScalarType } from 'graphql'
import * as graphql from 'graphql'

export const GraphQLUpload = new GraphQLScalarType({
export const GraphQLUpload = new graphql.GraphQLScalarType({
name: 'Upload',
description:
'The `Upload` scalar type represents a file upload promise that resolves ' +
Expand Down

0 comments on commit ad63db9

Please sign in to comment.