Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xnerhu committed Oct 22, 2024
1 parent eabfd4b commit b0c4de3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/sources/notification_permissions.test.ts
Original file line number Diff line number Diff line change
@@ -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 }

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/sources/plugins_length.test.ts
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand All @@ -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
}
Expand Down
7 changes: 0 additions & 7 deletions src/sources/webgl.test.ts
Original file line number Diff line number Diff line change
@@ -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')
Expand Down

0 comments on commit b0c4de3

Please sign in to comment.