Skip to content

Commit

Permalink
Use async/await in test servers
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Apr 28, 2019
1 parent 6399e06 commit 72f6894
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion test/servers/bunyan-custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ let app = new Server({
})
app.nodeId = 'server:FnXaqDxY'

app.auth(() => Promise.resolve(true))
app.auth(async () => true)

app.listen()
2 changes: 1 addition & 1 deletion test/servers/bunyan.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ let app = new Server({
})
app.nodeId = 'server:FnXaqDxY'

app.auth(() => Promise.resolve(true))
app.auth(async () => true)

app.listen()
2 changes: 1 addition & 1 deletion test/servers/custom-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ let app = new Server({
})
app.nodeId = 'server:FnXaqDxY'

app.auth(() => Promise.resolve(true))
app.auth(async () => true)

app.listen()
14 changes: 7 additions & 7 deletions test/servers/destroy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env node

let delay = require('nanodelay')

let Server = require('../../server')

let app = new Server({
Expand All @@ -9,14 +11,12 @@ let app = new Server({
})
app.nodeId = 'server:FnXaqDxY'

app.auth(() => Promise.resolve(true))
app.auth(async () => true)

app.unbind.push(() => new Promise(resolve => {
setTimeout(() => {
process.stderr.write(' Custom destroy task finished\n')
resolve()
}, 10)
}))
app.unbind.push(async () => {
await delay(10)
process.stderr.write(' Custom destroy task finished\n')
})

app.listen()

Expand Down
2 changes: 1 addition & 1 deletion test/servers/eacces.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ let app = new Server({
})
app.nodeId = 'server:FnXaqDxY'

app.auth(() => Promise.resolve(true))
app.auth(async () => true)

app.listen()
2 changes: 1 addition & 1 deletion test/servers/eaddrinuse.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ let app = new Server({
})
app.nodeId = 'server:FnXaqDxY'

app.auth(() => Promise.resolve(true))
app.auth(async () => true)

app.listen()
2 changes: 1 addition & 1 deletion test/servers/missed.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ let app = new Server(
)
app.nodeId = 'server:FnXaqDxY'

app.auth(() => Promise.resolve(true))
app.auth(async () => true)

app.listen()
2 changes: 1 addition & 1 deletion test/servers/no-password.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ let app = new Server(
})
)

app.auth(() => Promise.resolve(true))
app.auth(async () => true)

app.listen()
2 changes: 1 addition & 1 deletion test/servers/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ let app = new Server(
)
app.nodeId = 'server:FnXaqDxY'

app.auth(() => Promise.resolve(true))
app.auth(async () => true)

app.listen()
2 changes: 1 addition & 1 deletion test/servers/unknown.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ let app = new Server(
)
app.nodeId = 'server:FnXaqDxY'

app.auth(() => Promise.resolve(true))
app.auth(async () => true)

app.listen()

0 comments on commit 72f6894

Please sign in to comment.