smartbrowser/test/test.ts

30 lines
912 B
TypeScript
Raw Normal View History

2017-04-09 10:35:53 +00:00
import { tap, expect } from 'tapbundle'
import * as smartdelay from 'smartdelay'
2016-09-19 18:00:19 +00:00
import * as smartbrowser from '../dist/index'
let testSmartBrowser: smartbrowser.Smartbrowser
2017-04-09 10:35:53 +00:00
tap.test('should instanstiate a new browser ', async () => {
testSmartBrowser = new smartbrowser.Smartbrowser({
webroot: './test/assets/',
watchFiles: [ './test/assets/' ]
})
return expect(testSmartBrowser).to.be.instanceof(smartbrowser.Smartbrowser)
}).catch(tap.threw)
tap.test('should start the browser ', async () => {
return await expect(testSmartBrowser.start()).to.eventually.be.fulfilled
}).catch(tap.threw)
tap.test('should stop the browser ', async () => {
return await smartdelay.delayFor(2000).then(() => {
return expect(testSmartBrowser.stop()).to.eventually.be.fulfilled
})
})
tap.test('should exit correctly', async () => {
smartdelay.delayFor(2000).then(() => {
process.exit(0)
})
2016-09-19 18:00:19 +00:00
})