This commit is contained in:
2018-12-19 17:17:25 +01:00
parent 0b4af4331c
commit bcd7b5cf90
9 changed files with 34614 additions and 51 deletions

7
test/index.html Normal file
View File

@ -0,0 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script src="./test.ts"></script>
</head>
<body></body>
</html>

View File

@ -1,16 +1,17 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as webdetector from '../ts/index'
let testWebDetector: webdetector.WebDetector;
console.log('hi');
tap.test('should create a valid instance of webdetector', async () => {
testWebDetector = new webdetector.WebDetector();
expect(testWebDetector).to.be.instanceOf(webdetector.WebDetector);
})
tap.test('should determine if we are currently online', async () => {
let onlineResultBoolean = await testWebDetector.isOnline();
expect(onlineResultBoolean).to.be.true;
});
tap.start()
const run = async () => {
const testWebDetector = new webdetector.WebDetector({
checkOnlineUrl: 'https://pubapi.lossless.one'
});
const onlineResultBoolean = await testWebDetector.isOnline();
console.log('browser is online:')
console.log(onlineResultBoolean);
testWebDetector.startPeriodicChecks();
testWebDetector.onlineObservable.subscribe((state) => {
console.log(state);
})
}
run();