summaryrefslogtreecommitdiffhomepage
path: root/vitest-setup.ts
blob: 143ac96eb7f0d34454ecd4da81921c16d4988b81 (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 {}
  };
}