mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
451 B
22 lines
451 B
11 years ago
|
var fs
|
||
|
try { fs = require('graceful-fs') } catch (e) { fs = require('fs') }
|
||
|
var test = require('tap').test
|
||
|
var glob = require('../')
|
||
|
|
||
|
test('mock fs', function(t) {
|
||
|
fs.readdir = function(path, cb) {
|
||
|
process.nextTick(function() {
|
||
|
cb(new Error('mock fs.readdir error'))
|
||
|
})
|
||
|
}
|
||
|
t.pass('mocked')
|
||
|
t.end()
|
||
|
})
|
||
|
|
||
|
test('error callback', function(t) {
|
||
|
glob('*', function(err, res) {
|
||
|
t.ok(err, 'expecting mock error')
|
||
|
t.end()
|
||
|
})
|
||
|
})
|