-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
33 lines (29 loc) · 1.03 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*!
* is-sync-function <https://github.com/tunnckoCore/is-sync-function>
*
* Copyright (c) 2015 Charlike Mike Reagent <@tunnckoCore> (http://www.tunnckocore.tk)
* Released under the MIT license.
*/
/* jshint asi:true */
'use strict'
var fs = require('fs')
var test = require('assertit')
var isSyncFunction = require('./index')
test('is-sync-function:', function () {
test('should return true for synchronous functions', function (done) {
test.equal(isSyncFunction(fs.readFileSync), true)
test.equal(isSyncFunction(fs.renameSync), true)
test.equal(isSyncFunction(fs.statSync), true)
test.equal(isSyncFunction(fs.chownSync), true)
test.equal(isSyncFunction(JSON.stringify), true)
test.equal(isSyncFunction(JSON.parse), true)
done()
})
test('should return false for async functions', function (done) {
test.equal(isSyncFunction(fs.readFile), false)
test.equal(isSyncFunction(fs.rename), false)
test.equal(isSyncFunction(fs.stat), false)
test.equal(isSyncFunction(fs.chown), false)
done()
})
})