summaryrefslogtreecommitdiffhomepage
path: root/vitest-setup.ts
blob: 10a316024f35ded7ee221f93378bf98ce5f5656a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import "@testing-library/jest-dom/vitest";
import "fake-indexeddb/auto";

// jsdom implements neither Element.scrollTo nor ResizeObserver; the smart-scroll
// controller uses both against the real transcript element when App mounts. Stub
// the outermost edges so component tests can render without throwing.
if (typeof Element !== "undefined" && typeof Element.prototype.scrollTo !== "function") {
	Element.prototype.scrollTo = () => {};
}
if (typeof globalThis.ResizeObserver === "undefined") {
	globalThis.ResizeObserver = class {
		observe(): void {}
		unobserve(): void {}
		disconnect(): void {}
	};
}