webdetector/test/test.both.ts

27 lines
714 B
TypeScript
Raw Permalink Normal View History

2023-06-10 11:46:58 +00:00
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();