diff --git a/frontend/src/test/setup.ts b/frontend/src/test/setup.ts index bdd9bbe..cd10a57 100644 --- a/frontend/src/test/setup.ts +++ b/frontend/src/test/setup.ts @@ -1,27 +1,32 @@ import '@testing-library/jest-dom' -global.ResizeObserver = class ResizeObserver { +const MockResizeObserver = class { observe() {} unobserve() {} disconnect() {} } +;(globalThis as any).ResizeObserver = MockResizeObserver -global.DOMRect = class DOMRect { - x: number; y: number; width: number; height: number; top: number; right: number; bottom: number; left: number +const MockDOMRect = class { + x = 0; y = 0; width = 0; height = 0; top = 0; right = 0; bottom = 0; left = 0 constructor(x = 0, y = 0, width = 0, height = 0) { this.x = x; this.y = y; this.width = width; this.height = height this.top = y; this.right = x + width; this.bottom = y + height; this.left = x } - static fromRect() { return new DOMRect() } + static fromRect() { return new (MockDOMRect as any)() } toJSON() { return { x: this.x, y: this.y, width: this.width, height: this.height, top: this.top, right: this.right, bottom: this.bottom, left: this.left } } } +;(globalThis as any).DOMRect = MockDOMRect -global.DOMMatrix = class DOMMatrix { +const MockDOMMatrix = class { a = 1; b = 0; c = 0; d = 1; e = 0; f = 0 is2D = true isIdentity = true - static fromMatrix() { return new DOMMatrix() } - multiply() { return new DOMMatrix() } - translate() { return new DOMMatrix() } - scale() { return new DOMMatrix() } + static fromMatrix() { return new (MockDOMMatrix as any)() } + static fromFloat32Array() { return new (MockDOMMatrix as any)() } + static fromFloat64Array() { return new (MockDOMMatrix as any)() } + multiply() { return new (MockDOMMatrix as any)() } + translate() { return new (MockDOMMatrix as any)() } + scale() { return new (MockDOMMatrix as any)() } } +;(globalThis as any).DOMMatrix = MockDOMMatrix