fix: proper opening of the mac app on bookmarklet

This commit is contained in:
2026-02-22 18:38:56 +01:00
parent 2d451dc1f0
commit c6afd545a6
10 changed files with 401 additions and 22 deletions

View File

@@ -0,0 +1,31 @@
import { describe, expect, it, vi } from 'vitest';
import { createDeferredEventGate } from '../../../src/renderer/navigation/deferredEventGate';
describe('createDeferredEventGate', () => {
it('queues events until marked ready', () => {
const gate = createDeferredEventGate<string>();
const consume = vi.fn();
gate.push('first', consume);
gate.push('second', consume);
expect(consume).not.toHaveBeenCalled();
gate.markReady(consume);
expect(consume).toHaveBeenCalledTimes(2);
expect(consume).toHaveBeenNthCalledWith(1, 'first');
expect(consume).toHaveBeenNthCalledWith(2, 'second');
});
it('consumes immediately after ready', () => {
const gate = createDeferredEventGate<string>();
const consume = vi.fn();
gate.markReady(consume);
gate.push('now', consume);
expect(consume).toHaveBeenCalledTimes(1);
expect(consume).toHaveBeenCalledWith('now');
});
});