mirror of
https://github.com/motajs/template.git
synced 2026-11-02 06:34:31 +08:00
test(event): polyfill map insertion in fixtures
This commit is contained in:
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 = {
|
||||
|
||||
Reference in new issue
Block a user