Files
Netcatty/application/state/sidePanelLiveStore.test.ts
T
bincxz 71687491f0 Fix terminal theme mode switching and speed up workspace tab changes.
Keep connection dialog and chrome surfaces in sync when toggling follow-app vs manual themes, and isolate side-panel live state per tab so switching workspace tabs no longer re-renders every mounted panel.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-28 03:28:50 +08:00

36 lines
995 B
TypeScript

import assert from 'node:assert/strict';
import test from 'node:test';
import {
getSidePanelLiveSnapshot,
sidePanelLiveStore,
SIDE_PANEL_INACTIVE_LIVE_SNAPSHOT,
} from './sidePanelLiveStore.ts';
test('sidePanelLiveStore skips notify when snapshot is unchanged', () => {
let notifications = 0;
const unsubscribe = sidePanelLiveStore.subscribe(() => {
notifications += 1;
});
const snapshot = {
...SIDE_PANEL_INACTIVE_LIVE_SNAPSHOT,
activeTerminalCwd: '/tmp',
};
sidePanelLiveStore.update(snapshot);
sidePanelLiveStore.update({ ...snapshot });
unsubscribe();
assert.equal(notifications, 1);
});
test('getSidePanelLiveSnapshot returns inactive snapshot when disabled', () => {
sidePanelLiveStore.update({
...SIDE_PANEL_INACTIVE_LIVE_SNAPSHOT,
activeTerminalCwd: '/var/log',
});
assert.equal(getSidePanelLiveSnapshot(false), SIDE_PANEL_INACTIVE_LIVE_SNAPSHOT);
assert.equal(getSidePanelLiveSnapshot(true).activeTerminalCwd, '/var/log');
});