From 2060cc9bf11032203f6155867e63ec4e4fa5699d Mon Sep 17 00:00:00 2001 From: Alan Gutierrez Date: Mon, 26 May 2014 08:15:14 -0700 Subject: [PATCH] Test user specified callback to wrapped module. Closes #86. --- release.md | 3 +++ t/main/executable.t.js | 6 ++++-- t/main/fixtures/echo.js | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 release.md diff --git a/release.md b/release.md new file mode 100644 index 0000000..a2258e2 --- /dev/null +++ b/release.md @@ -0,0 +1,3 @@ +### Issue by Issue + + * Test user specified callback to wrapped module. #86. diff --git a/t/main/executable.t.js b/t/main/executable.t.js index 9f3f46f..8c1fd82 100755 --- a/t/main/executable.t.js +++ b/t/main/executable.t.js @@ -1,11 +1,13 @@ #!/usr/bin/env node -require('proof')(1, function (ok, equal) { +require('proof')(2, function (ok, equal) { var echo = require('./fixtures/echo') var stream = require('stream') var stdout = new stream.PassThrough var chunks = [] stdout.on('data', function (data) { chunks.push(data.toString()) }) - echo([ 'a', 'b' ], stdout) + echo([ 'a', 'b' ], stdout, null, null, function () { + ok(1, 'called back') + }) equal(chunks.join(''), 'a b\n', 'executable') }) diff --git a/t/main/fixtures/echo.js b/t/main/fixtures/echo.js index 81a93bd..c3a281d 100644 --- a/t/main/fixtures/echo.js +++ b/t/main/fixtures/echo.js @@ -6,7 +6,7 @@ ___ usage ___ */ -require('../../../executable')(module, function (options, stdout) { +require('../../../executable')(module, function (options, stdout, stderr, stdin, callback) { if (options.argv.length) { var separator = '' options.argv.forEach(function (arg) { @@ -16,4 +16,5 @@ require('../../../executable')(module, function (options, stdout) { }) stdout.write('\n') } + callback() })