Skip to content

Commit

Permalink
Todo test for missing map and file fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
krasivyy3954 committed Aug 2, 2018
1 parent 8e6fb60 commit c13f8f8
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1141,3 +1141,61 @@ t.test('Misorder files before ‘map’.', async t => {
await sendRequest(t, port)
})
})

t.todo('Missing ‘map’ and files.', async t => {
t.jobs = 2

const sendRequest = async (t, port) => {
const body = new FormData()

body.append(
'operations',
JSON.stringify({
variables: {
file: null
}
})
)

const { status } = await fetch(`http://localhost:${port}`, {
method: 'POST',
body
})

t.equal(status, 400, 'Response status.')
}

await t.test('Koa middleware.', async t => {
t.plan(2)

const app = new Koa()
.on('error', () =>
// Todo: Test the error.
t.pass('Error.')
)
.use(apolloUploadKoa())

const port = await startServer(t, app)

await sendRequest(t, port)
})

await t.test('Express middleware.', async t => {
t.plan(2)

const app = express()
.use(apolloUploadExpress())
.use((error, request, response, next) => {
if (response.headersSent) return next(error)

// Todo: Test the error.
t.pass('Error.')

response.send()
})

const port = await startServer(t, app)

await sendRequest(t, port)
})
})

0 comments on commit c13f8f8

Please sign in to comment.