diff --git a/tests/server.test.js b/tests/server.test.js index 260b7385..6a9c8bf0 100644 --- a/tests/server.test.js +++ b/tests/server.test.js @@ -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() + }) + }) }) })