2023-06-10 11:46:58 +00:00
|
|
|
import { tap, expect } from '@pushrocks/tapbundle';
|
|
|
|
|
2023-06-11 14:09:06 +00:00
|
|
|
import * as webdetector from '../ts/webdetector.classes.webdetector.js';
|
2023-06-10 11:46:58 +00:00
|
|
|
let testWebDetector: webdetector.WebDetector;
|
|
|
|
|
|
|
|
tap.test('first test', async () => {
|
2023-06-10 14:38:25 +00:00
|
|
|
testWebDetector = new webdetector.WebDetector({
|
2023-06-10 11:46:58 +00:00
|
|
|
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);
|
|
|
|
});
|
2023-06-10 14:43:20 +00:00
|
|
|
testWebDetector.stopPeriodicChecks();
|
2023-06-10 11:46:58 +00:00
|
|
|
});
|
|
|
|
|
2023-06-10 14:38:25 +00:00
|
|
|
tap.test('should detect the platform', async () => {
|
|
|
|
const platform = testWebDetector.platform.detectPlatform();
|
|
|
|
console.log(platform);
|
|
|
|
});
|
|
|
|
|
2023-06-11 14:09:06 +00:00
|
|
|
tap.test('should detect if the app is installed', async () => {
|
|
|
|
const isInstalled = testWebDetector.pwa.isInstalled();
|
|
|
|
expect(isInstalled).toBeFalse();
|
|
|
|
});
|
|
|
|
|
2023-06-10 11:46:58 +00:00
|
|
|
console.log('hi');
|
|
|
|
|
|
|
|
tap.start();
|