smartbrowser/test/test.ts
2019-05-28 23:27:55 +02:00

33 lines
952 B
TypeScript

import { tap, expect } from 'tapbundle';
import * as smartdelay from 'smartdelay';
import * as smartbrowser from '../dist/index';
let testSmartBrowser: smartbrowser.Smartbrowser;
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);
});
});