Skip to content

Commit

Permalink
Fix for new v3 API
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Jul 26, 2022
1 parent 3ee6a92 commit ebb5de3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/graphql-yoga/__tests__/node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1401,15 +1401,16 @@ it('should return 404 if request path does not match with the defined endpoint',
const hostname = '127.0.0.1'
const port = 4000 + Math.floor(Math.random() * 1000)
const endpoint = '/mypath'
const yoga = createServer({
const yoga = createYoga({
endpoint,
hostname,
port,
logging: false,
})
const server = createServer(yoga)
const url = `http://${hostname}:${port}${endpoint}`
try {
await yoga.start()
await new Promise<void>((resolve) =>
server.listen(port, hostname, () => resolve()),
)
const response = await fetch(
url + '?query=' + encodeURIComponent('{ __typename }'),
)
Expand All @@ -1421,6 +1422,8 @@ it('should return 404 if request path does not match with the defined endpoint',
)
expect(response2.status).toEqual(404)
} finally {
await yoga.stop()
await new Promise<void>((resolve, reject) =>
server.close((err) => (err ? reject(err) : resolve())),
)
}
})

0 comments on commit ebb5de3

Please sign in to comment.