Skip to content

Commit

Permalink
cleanup unused done in test function
Browse files Browse the repository at this point in the history
  • Loading branch information
tunnckoCore committed Jun 21, 2016
1 parent 186f120 commit f9352ff
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions test/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
var test = require('mukla')
var letta = require('../index')

test('should catch TypeError thrown if not function', function (done) {
test('should catch TypeError thrown if not function', function () {
return letta(1234).catch(function (err) {
test.strictEqual(/expect `fn` be function/.test(err.message), true)
})
})

test('should returned error be passed to `.then` function', function (done) {
test('should returned error be passed to `.then` function', function () {
return letta(function () {
return new Error('foo bar baz')
}).then(function (res) {
Expand All @@ -28,7 +28,7 @@ test('should returned error be passed to `.then` function', function (done) {
})
})

test('should mute all errors and pass them to `.catch` function', function (done) {
test('should mute all errors and pass them to `.catch` function', function () {
return letta(function () {
foobar // eslint-disable-line no-undef
return 123
Expand Down
4 changes: 2 additions & 2 deletions test/generators.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ function * failure () {
return yield mzfs.readFile('foobar.json')
}

test('should handle successful generator function', function (done) {
test('should handle successful generator function', function () {
return letta(success).then(function (res) {
test.strictEqual(typeof res, 'string')
test.ok(res.indexOf('"license": "MIT"') !== -1)
})
})

test('should handle generator function errors', function (done) {
test('should handle generator function errors', function () {
return letta(failure).catch(function (err) {
test.ifError(!err)
test.ok(err instanceof Error)
Expand Down
12 changes: 6 additions & 6 deletions test/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,40 +37,40 @@ function failReadFile () {
return fs.readFileSync('foo-bar')
}

test('should handle result when JSON.parse pass', function (done) {
test('should handle result when JSON.parse pass', function () {
return letta(successJsonParse).then(function (res) {
test.deepEqual(res, {foo: 'bar'})
})
})

test('should handle error when JSON.parse fail', function (done) {
test('should handle error when JSON.parse fail', function () {
return letta(returnFailingJsonParse).catch(function (err) {
test.ifError(!err)
test.ok(err instanceof Error)
})
})

test('should handle result when fs.readFileSync pass', function (done) {
test('should handle result when fs.readFileSync pass', function () {
return letta(successReadFile).then(function (res) {
test.ok(res.indexOf('"license": "MIT"') !== -1)
})
})

test('should handle error when fs.readFileSync fail', function (done) {
test('should handle error when fs.readFileSync fail', function () {
return letta(failReadFile).catch(function (err) {
test.ifError(!err)
test.ok(err instanceof Error)
})
})

test('should handle thrown errors', function (done) {
test('should handle thrown errors', function () {
return letta(noReturnFailJsonParse).catch(function (err) {
test.ifError(!err)
test.ok(err instanceof Error)
})
})

test('should pass whole returned array to single argument', function (done) {
test('should pass whole returned array to single argument', function () {
return letta(returnArray).then(function (arr) {
test.deepEqual(arr, [4, 5, 6])
})
Expand Down

0 comments on commit f9352ff

Please sign in to comment.