27 lines
714 B
TypeScript
27 lines
714 B
TypeScript
|
import { tap, expect } from '@pushrocks/tapbundle';
|
||
|
|
||
|
import * as webdetector from '../ts/index';
|
||
|
let testWebDetector: webdetector.WebDetector;
|
||
|
|
||
|
tap.test('first test', async () => {
|
||
|
const testWebDetector = new webdetector.WebDetector({
|
||
|
checkOnlineUrl: 'https://pubapi.lossless.one',
|
||
|
});
|
||
|
|
||
|
expect(testWebDetector).toBeInstanceOf(webdetector.WebDetector);
|
||
|
});
|
||
|
|
||
|
tap.test('should be online', async () => {
|
||
|
const onlineResultBoolean = await testWebDetector.isOnline();
|
||
|
console.log('browser is online:');
|
||
|
console.log(onlineResultBoolean);
|
||
|
testWebDetector.startPeriodicChecks();
|
||
|
testWebDetector.onlineObservable.subscribe((state) => {
|
||
|
console.log(state);
|
||
|
});
|
||
|
});
|
||
|
|
||
|
console.log('hi');
|
||
|
|
||
|
tap.start();
|