Skip to content

Commit

Permalink
adds coverage for new code
Browse files Browse the repository at this point in the history
  • Loading branch information
selfcontained committed Aug 2, 2016
1 parent c6f11ae commit 2997fe9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/slapp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ test('Slapp()', t => {
t.is(typeof app.emit, 'function')
})

test('Slapp() w/o context', t => {
t.throws(() => {
let app = new Slapp()
t.is(null, app)
t.fail()
})
})

test('Slapp.use()', t => {
let mw = () => {}
let app = new Slapp({ context })
Expand Down Expand Up @@ -103,6 +111,20 @@ test('Slapp.match()', t => {
t.deepEqual(app._matchers, [fn])
})

test.cb('Slapp._handle() w/ a bad message', t => {
t.plan(2)

let app = new Slapp({ context })
let message = new Message('event', {}, {})

let emitSpy = sinon.stub(app, 'emit')
app._handle(message, (err) => {
t.not(err, null)
t.true(emitSpy.calledWith('error'))
t.end()
})
})

test.cb('Slapp._handle() 1 mw, no override, no matchers', t => {
t.plan(4)

Expand Down

0 comments on commit 2997fe9

Please sign in to comment.