From 7770d579a6491ce02c1f693a72759f49b6b9a7bc Mon Sep 17 00:00:00 2001 From: Eric Satterwhite Date: Sat, 27 May 2017 21:56:21 -0500 Subject: [PATCH] fixing up a transport test --- test/integration/custom-transport.spec.js | 27 +++++++++++++++++------ test/integration/test.transport | 8 +++++++ 2 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 test/integration/test.transport diff --git a/test/integration/custom-transport.spec.js b/test/integration/custom-transport.spec.js index cff55c89..fa05b6ea 100644 --- a/test/integration/custom-transport.spec.js +++ b/test/integration/custom-transport.spec.js @@ -37,7 +37,10 @@ test('server', (t) => { , transports: [foobar] }) .load() - .listen(5555, null, null, ttt.end) + .listen(5555, null, null, (err) => { + ttt.error(err) + ttt.end() + }) }) tt.test('tap transport', (ttt) => { @@ -76,28 +79,38 @@ test('server', (t) => { , app: 'spec' } , seeds: [`${hostname}:6543`] - , transports: [path.resolve(__dirname, 'tap.transport')] + , storage: { + backend: 'leveldown' + , path: '/tmp/sk22' + } + , transports: [require.resolve(path.join(__dirname, 'test.transport'))] }) .load() - .listen(5555, null, null, ttt.end) + .listen(5555, null, null, (err) => { + console.log('ending') + ttt.error(err) + ttt.end() + }) }) tt.test('tap transport', (ttt) => { + console.log('requesting') supertest('http://localhost:5555') .post('/timer') .send({ timeout: 250 - , data: { put: ttt.ok, foobar: 1} + , data: 'hello world' , callback: { - transport: 'tap' + transport: 'http' , method: 'put' - , uri: 'doesn\'t matter' + , uri: 'http://localhost:4444' } }) .expect(201) .end((err, res) => { + console.log('response') ttt.error(err) - ttt.type(server._timers.transports.tap, 'function') + ttt.type(server._timers.transports.test, 'function') ttt.end() }) }) diff --git a/test/integration/test.transport b/test/integration/test.transport new file mode 100644 index 00000000..a260a4ff --- /dev/null +++ b/test/integration/test.transport @@ -0,0 +1,8 @@ +'use string' + +if (require.main === module) return + +module.exports = function test(method, url ,payload, id, storage) { + console.log('test transport') + storage.remove(id) +}