uci-utils-watcher/test/watcher.test.js

48 lines
1.2 KiB
JavaScript

import Watcher from '../src/watcher'
// import to from 'await-to-js'
import { expect } from 'chai'
import { it } from 'mocha'
describe('Watcher Class Testing ',async ()=> {
// let log = logger({})
before(async () => {
// log = logger({ package:'@uci/sync', id: 'sync-test' })
let options = {source:'./test/repo', ignored:['**/dontwatch.js'],ignoreList:['./test/repo/.gitignore']}
let watcher = new Watcher(options)
await watcher.start()
watcher.on('changed',
// debounce(
(change) => {
console.log(`======= file ${change.file} was ${change.type} ==========`)
}
)
})
it('can watch for file delete' , async function () {
// let [err,res] = await to(remote.exec('cd /opt && pwd'))
// if (err) {
// log.info('error running command aborting test', err)
// return
// }
// log.info(`result of remote command ${res.command} => ${res.reply.toString().trim()}`)
expect('test', 'test failed').to.equal('test')
})
})
// function hooks(remote) {
//
// // beforeEach(async() => {
// // await someasyncfunctiontodobeforeeachtest()
// // })
//
// // after(async() => {
// // await someasyncfunctiontodoaftereeachtest()
// // })
//
// }