-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
33 lines (29 loc) · 936 Bytes
/
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
/*!
* always-thunk <https://github.com/hybridables/always-thunk>
*
* 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 alwaysThunk = require('./index')
test('always-thunk:', function () {
test('should transform sync function to thunk', function (done) {
var readFileSync = alwaysThunk(fs.readFileSync)
readFileSync('./package.json', 'utf8')(function (err, res) {
test.ifError(err)
test.ok(res.indexOf('"license": "MIT"') !== -1)
done()
})
})
test('should transform asynchronous function to thunk', function (done) {
var readFile = alwaysThunk(fs.readFile)
readFile('./package.json', 'utf8')(function (err, res) {
test.ifError(err)
test.ok(res.indexOf('"license": "MIT"') !== -1)
done()
})
})
})