From 5fd1ec073a30d1a113f1bc45664baf04e83e694c Mon Sep 17 00:00:00 2001 From: qazsato Date: Tue, 3 Dec 2024 23:32:15 +0900 Subject: [PATCH] fix test --- tests/DebugView.test.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/DebugView.test.ts b/tests/DebugView.test.ts index f1ca083..3befba5 100644 --- a/tests/DebugView.test.ts +++ b/tests/DebugView.test.ts @@ -1,5 +1,6 @@ import { describe, expect, beforeEach, it } from '@jest/globals' import { DebugView } from '../src/components/DebugView' +import { WebkitDeviceOrientationEvent } from '../src/maplibre-gl-compass' describe('DebugView', () => { let parentElement: HTMLElement @@ -19,7 +20,12 @@ describe('DebugView', () => { }) it('should update heading values', () => { - debugView.update('180.123') + debugView.update(180.123, { + type: 'deviceorientation', + alpha: 0, + beta: 0, + gamma: 0, + } as WebkitDeviceOrientationEvent) const headingSpan = parentElement.querySelector('.heading') expect(headingSpan?.textContent).toBe('180.123') @@ -31,7 +37,14 @@ describe('DebugView', () => { const updatedHeadingSpan = parentElement.querySelector('.heading') - expect(() => debugView.update('180.123')).not.toThrow() + expect(() => + debugView.update(180.123, { + type: 'deviceorientation', + alpha: 0, + beta: 0, + gamma: 0, + } as WebkitDeviceOrientationEvent), + ).not.toThrow() expect(updatedHeadingSpan).toBeNull() }) })