smartbrowser/test/test.ts

33 lines
952 B
TypeScript
Raw Normal View History

2019-05-28 21:27:55 +00:00
import { tap, expect } from 'tapbundle';
import * as smartdelay from 'smartdelay';
2016-09-19 18:00:19 +00:00
2019-05-28 21:27:55 +00:00
import * as smartbrowser from '../dist/index';
let testSmartBrowser: smartbrowser.Smartbrowser;
2016-09-19 18:00:19 +00:00
2019-05-28 21:27:55 +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);
2017-04-09 10:35:53 +00:00
})
2019-05-28 21:27:55 +00:00
.catch(tap.threw);
2017-04-09 10:35:53 +00:00
2019-05-28 21:27:55 +00:00
tap
.test('should start the browser ', async () => {
return await expect(testSmartBrowser.start()).to.eventually.be.fulfilled;
})
.catch(tap.threw);
2017-04-09 10:35:53 +00:00
tap.test('should stop the browser ', async () => {
return await smartdelay.delayFor(2000).then(() => {
2019-05-28 21:27:55 +00:00
return expect(testSmartBrowser.stop()).to.eventually.be.fulfilled;
});
});
2017-04-09 10:35:53 +00:00
tap.test('should exit correctly', async () => {
smartdelay.delayFor(2000).then(() => {
2019-05-28 21:27:55 +00:00
process.exit(0);
});
});