fix(core): close Bridges on exit without a fake offline

This commit is contained in:
DrSmoothl committed 2026-08-17 00:08:21 +08:00
1 parent 27284fd79b
commit d5f1e35c31
9 files changed
+92 -8

No files matched your search

@@ -196,4 +196,13 @@ describe('NotificationManager — debounce integration (fake timers)', () => {
await vi.advanceTimersByTimeAsync(0);
expect(events).toEqual(['offline']);
});
it('ignores online/offline after dispose so process exit is not a runtime drop', async () => {
const { events, mgr } = setup(0);
mgr.dispose();
mgr.handleOnline('123', 'Bob');
mgr.handleOffline('123', 'Bob');
await vi.advanceTimersByTimeAsync(0);
expect(events).toEqual([]);
});
});
@@ -43,7 +43,7 @@ describe('createStateWiring', () => {
expect(sub).toHaveBeenNthCalledWith(2, 'connections');
});
it('dispose() unwires onSessionsChanged + BridgeManager listeners (no further publishes)', () => {
it('dispose() latches so later Hook/Bridge edges publish nothing', () => {
const wiring = createStateWiring();
const bm = new BridgeManager();
wiring.bindBridgeManager(bm);