Skip to content

Commit

Permalink
Improve redeliver test
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonEtco committed Dec 8, 2017
1 parent 5d180fb commit bbca36a
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions tests/server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,21 @@ describe('server', () => {
done()
})
})
})

it('POST /:channel/redeliver re-emits a payload', async () => {
const payload = {
foo: true,
bar: false
}
it('POST /:channel/redeliver re-emits a payload', async (done) => {
const payload = {payload: true}

await request(server).post(channel + '/redeliver')
.send(payload)
.expect(200)

events.addEventListener('message', (msg) => {
const data = JSON.parse(msg.data)
expect(data).toEqual(payload)

const res = await request(server).post('/jason/redeliver').send(payload)
expect(res.status).toBe(200)
// test is done if all of this gets called
done()
})
})
})
})

0 comments on commit bbca36a

Please sign in to comment.