From b0c4de3628a30b44562bae857a458b9f98f651be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Palkiewicz?= Date: Tue, 22 Oct 2024 08:57:26 +0200 Subject: [PATCH] fix tests --- src/sources/notification_permissions.test.ts | 6 +++--- src/sources/plugins_length.test.ts | 4 ++-- src/sources/webgl.test.ts | 7 ------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/sources/notification_permissions.test.ts b/src/sources/notification_permissions.test.ts index ffe256ed..931f98c0 100644 --- a/src/sources/notification_permissions.test.ts +++ b/src/sources/notification_permissions.test.ts @@ -1,10 +1,10 @@ -import { getBrowserVersion, isHeadlessChrome, isMobile, isWebKit } from '../../tests/utils' +import { getBrowserVersion, isMobile, isWebKit } from '../../tests/utils' import { BotdError, BrowserEngineKind, BrowserKind } from '../types' import { getBrowserEngineKind, getBrowserKind } from '../utils/browser' import getNotificationPermissions from './notification_permissions' describe('Sources', () => { - describe('notificaionPermissions', () => { + describe('notificationPermissions', () => { it('returns an expected value or throws', async () => { const { major, minor } = getBrowserVersion() ?? { major: 0, minor: 0 } @@ -29,7 +29,7 @@ describe('Sources', () => { const result = await getNotificationPermissions() - if (isHeadlessChrome() || isWebKit()) { + if (isWebKit()) { // It's true because HeadlessChrome returns "denied" and not "default". expect(result).toBeTrue() return diff --git a/src/sources/plugins_length.test.ts b/src/sources/plugins_length.test.ts index 69735f26..d6eb6b29 100644 --- a/src/sources/plugins_length.test.ts +++ b/src/sources/plugins_length.test.ts @@ -1,4 +1,4 @@ -import { getBrowserVersion, isChromium, isGecko, isWebKit, isMobile, isHeadlessChrome } from '../../tests/utils' +import { getBrowserVersion, isChromium, isGecko, isWebKit, isMobile } from '../../tests/utils' import getPluginsLength from './plugins_length' describe('Sources', () => { @@ -8,7 +8,7 @@ describe('Sources', () => { const version = getBrowserVersion() ?? { major: 0, minor: 0 } if (isChromium()) { - if (isHeadlessChrome() || isMobile()) { + if (isMobile()) { expect(result).toBe(0) return } diff --git a/src/sources/webgl.test.ts b/src/sources/webgl.test.ts index b195f1d9..f49bbf55 100644 --- a/src/sources/webgl.test.ts +++ b/src/sources/webgl.test.ts @@ -1,15 +1,8 @@ -import { isHeadlessChrome } from '../../tests/utils' -import { BotdError } from '../types' import getWebGL from './webgl' describe('Sources', () => { describe('webgl', () => { it('returns expected values or throws', () => { - if (isHeadlessChrome()) { - expect(() => getWebGL()).toThrow(new BotdError(-4, 'WebGLRenderingContext is null')) - return - } - const result = getWebGL() expect(typeof result.renderer).toBe('string')