Skip to content

Commit

Permalink
Add 2 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescostian committed Oct 31, 2014
1 parent 81b2043 commit c7ce48d
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -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()
})
})
})

0 comments on commit c7ce48d

Please sign in to comment.