Add spec for pathwatcher module.

This commit is contained in:
Cheng Zhao 2014-01-09 20:29:54 +08:00
parent c76f510cea
commit a12754f980
2 changed files with 15 additions and 1 deletions

View file

@ -6,9 +6,11 @@
"coffee-script": "~1.6.3",
"coffeelint": "~0.6.1",
"mocha": "~1.13.0",
"pathwatcher": "0.13.0",
"walkdir": "~0.0.7",
"runas": "0.3.0",
"formidable": "~1.0.14"
"formidable": "~1.0.14",
"temp": "~0.6.0"
},
"private": true,

View file

@ -1,9 +1,11 @@
assert = require 'assert'
fs = require 'fs'
path = require 'path'
temp = require 'temp'
describe 'third-party module', ->
fixtures = path.join __dirname, 'fixtures'
temp.track()
describe 'runas', ->
it 'can be required in renderer', ->
@ -15,3 +17,13 @@ describe 'third-party module', ->
child.on 'message', (msg) ->
assert.equal msg, 'ok'
done()
describe 'pathwatcher', ->
it 'emits file events correctly', (done) ->
pathwatcher = require 'pathwatcher'
temp.mkdir 'dir', (err, dir) ->
watcher = pathwatcher.watch dir, (event) ->
assert.equal event, 'change'
watcher.close()
done()
fs.writeFile path.join(dir, 'file'), ->