From c7ce48d39c2f46ce8d3c63eb4c3312a3f5a37ae9 Mon Sep 17 00:00:00 2001 From: James Costian Date: Fri, 31 Oct 2014 14:23:49 -0500 Subject: [PATCH] Add 2 tests --- test.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test.js diff --git a/test.js b/test.js new file mode 100644 index 0000000..6774594 --- /dev/null +++ b/test.js @@ -0,0 +1,30 @@ +var assert = require('assert') +var util = require('util') +var fs = require('fs') + +var converter = require('./index.js') + +describe('converter', function () { + it('should work if promises are used', function (done) { + converter(fs.createReadStream('./.jshintrc')).then(function (data) { + assert.equal(data, fs.readFileSync('./.jshintrc').toString(), 'the stream and the actual string matched') + done() + }).error(function (err) { + assert(false, 'ERROR!') + throw err + done() + }) + }) + it('should work if callbacks are used', function (done) { + converter(fs.createReadStream('./.jshintrc'), function (err, data) { + if (err) { + assert(false, 'ERROR!') + throw err + } + else { + assert.equal(data, fs.readFileSync('./.jshintrc').toString(), 'the stream and the actual string matched') + } + done() + }) + }) +})