Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test: unconditionally stub jsdom media and canvas prototype methods (#4397)

[._.]/ Adam Eivy362c4260cb54
diff --git a/client/src/test/setup.js b/client/src/test/setup.js
index cf20786acb..349cf9490d 100644
--- a/client/src/test/setup.js
+++ b/client/src/test/setup.js
@@ -26,43 +26,37 @@ if (!Element.prototype.scrollIntoView) {
// Stub jsdom missing media/canvas methods to eliminate stderr noise in test runs
if (typeof HTMLMediaElement !== 'undefined') {
- if (!HTMLMediaElement.prototype.play) {
- HTMLMediaElement.prototype.play = () => Promise.resolve();
- }
- if (!HTMLMediaElement.prototype.pause) {
- HTMLMediaElement.prototype.pause = () => {};
- }
+ HTMLMediaElement.prototype.play = () => Promise.resolve();
+ HTMLMediaElement.prototype.pause = () => {};
}
if (typeof HTMLCanvasElement !== 'undefined') {
- if (!HTMLCanvasElement.prototype.getContext) {
- HTMLCanvasElement.prototype.getContext = () => ({
- fillRect: () => {},
- clearRect: () => {},
- getImageData: (x, y, w, h) => ({ data: new Uint8ClampedArray(w * h * 4) }),
- putImageData: () => {},
- createImageData: () => ({ data: new Uint8ClampedArray(0) }),
- setTransform: () => {},
- drawImage: () => {},
- save: () => {},
- fillText: () => {},
- restore: () => {},
- beginPath: () => {},
- moveTo: () => {},
- lineTo: () => {},
- closePath: () => {},
- stroke: () => {},
- translate: () => {},
- scale: () => {},
- rotate: () => {},
- arc: () => {},
- fill: () => {},
- measureText: () => ({ width: 0 }),
- transform: () => {},
- rect: () => {},
- clip: () => {},
- });
- }
+ HTMLCanvasElement.prototype.getContext = () => ({
+ fillRect: () => {},
+ clearRect: () => {},
+ getImageData: (x, y, w, h) => ({ data: new Uint8ClampedArray(w * h * 4) }),
+ putImageData: () => {},
+ createImageData: () => ({ data: new Uint8ClampedArray(0) }),
+ setTransform: () => {},
+ drawImage: () => {},
+ save: () => {},
+ fillText: () => {},
+ restore: () => {},
+ beginPath: () => {},
+ moveTo: () => {},
+ lineTo: () => {},
+ closePath: () => {},
+ stroke: () => {},
+ translate: () => {},
+ scale: () => {},
+ rotate: () => {},
+ arc: () => {},
+ fill: () => {},
+ measureText: () => ({ width: 0 }),
+ transform: () => {},
+ rect: () => {},
+ clip: () => {},
+ });
}
// Fail any test that triggers React's "not wrapped in act(...)" warning (#2406).