test(event): polyfill map insertion in fixtures

This commit is contained in:
AncTe committed 2026-09-09 13:06:27 +08:00
1 parent 63d4d37ff3
commit 33966fb4dd
4 files changed
+37 -14

No files matched your search

@@ -18,6 +18,17 @@ import { AnonTokyoInterpreter } from 'anon-tokyo';
vi.hoisted(() => {
vi.stubGlobal('main', { replayChecking: true });
vi.stubGlobal('location', { origin: 'http://localhost' });
Map.prototype.getOrInsertComputed ??= function <K, V>(
this: Map<K, V>,
key: K,
callback: (key: K) => V
): V {
const existing = this.get(key);
if (existing !== undefined) return existing;
const value = callback(key);
this.set(key, value);
return value;
};
});
const eventTriggers = {