Skip to content

Commit

Permalink
Updated test
Browse files Browse the repository at this point in the history
  • Loading branch information
delvedor committed Jul 10, 2017
1 parent c75944d commit d40f36a
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions test/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test('boot an app with a plugin and a callback', (t) => {
})

test('boot a plugin with a custom server', (t) => {
t.plan(3)
t.plan(4)

const server = {}
const app = boot(server)
Expand All @@ -56,8 +56,43 @@ test('boot a plugin with a custom server', (t) => {
done()
})

app.onClose(() => {
t.ok('onClose called')
})

app.on('start', () => {
t.pass('booted')
app.close(() => {
t.pass('booted')
})
})
})

test('custom instance should inherits avvio methods', (t) => {
t.plan(6)

const server = {}
const app = boot(server, {})

server.use(function (s, opts, done) {
t.equal(s, server, 'the first argument is the server')
t.deepEqual(opts, {}, 'no options')
done()
}).after(() => {
t.ok('after called')
})

server.onClose(() => {
t.ok('onClose called')
})

server.ready(() => {
t.ok('ready called')
})

app.on('start', () => {
server.close(() => {
t.pass('booted')
})
})
})

Expand Down

0 comments on commit d40f36a

Please sign in to comment.