Skip to content

Commit

Permalink
chore(tests): simplify tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tunnckoCore committed Sep 21, 2016
1 parent 41190e1 commit be112bb
Showing 1 changed file with 16 additions and 38 deletions.
54 changes: 16 additions & 38 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ var test = require('mukla')
var matcher = require('is-match')
var isAsyncFunction = require('./index')

/**
* deps to test against
*/

var got = require('got')
var ghGot = require('gh-got')
var request = require('request')
var isMatch = require('is-match')

test('should throw TypeError if not function given', function (done) {
function fixture () {
isAsyncFunction(12345)
Expand All @@ -39,19 +48,9 @@ test('should return true for all async `fs` methods', function (done) {
done()
})

test('should return false for JSON.parse', function (done) {
var actual = isAsyncFunction(JSON.parse)
var expected = false

test.equal(actual, expected)
done()
})

test('should return false for JSON.stringify', function (done) {
var actual = isAsyncFunction(JSON.stringify)
var expected = false

test.equal(actual, expected)
test('should return false for JSON.parse and JSON.stringify', function (done) {
test.equal(isAsyncFunction(JSON.parse), false)
test.equal(isAsyncFunction(JSON.stringify), false)
done()
})

Expand All @@ -70,38 +69,17 @@ test('should return false for fs.readFileSync, fs.statSync, etc', function (done
done()
})

test('should return true for `request` package', function (done) {
var request = require('request')
var actual = isAsyncFunction(request)
var expected = true

test.equal(actual, expected)
test('should return true for `request`, `got` and `gh-got` packages', function (done) {
test.equal(isAsyncFunction(got), true)
test.equal(isAsyncFunction(ghGot), true)
test.equal(isAsyncFunction(request), true)
done()
})

test('should return false for `is-match` (micromatch) package', function (done) {
var isMatch = require('is-match')
var actual = isAsyncFunction(isMatch)
var expected = false

test.equal(actual, expected)
done()
})

test('should return true for `got` package', function (done) {
var got = require('got')
var actual = isAsyncFunction(got)
var expected = true

test.equal(actual, expected)
done()
})

test('should return true for `gh-got` package', function (done) {
var ghgot = require('gh-got')
var actual = isAsyncFunction(ghgot)
var expected = true

test.equal(actual, expected)
done()
})

0 comments on commit be112bb

Please sign in to comment.