chore: sanitize tests, add CONTEXT.md + ADRs, track tests/docs

This commit is contained in:
tommy0103
2026-07-08 16:11:12 +08:00
parent d5d5df46fa
commit 1a34245618
19 changed files with 3880 additions and 31 deletions
+27
View File
@@ -0,0 +1,27 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import {
createSessionLiveState,
consumeSessionDirty,
noteSessionUpdated,
} from '../app/renderer/src/session-live.mjs';
test('session live state marks non-visible updated sessions as dirty', () => {
const live = createSessionLiveState();
const action = noteSessionUpdated(live, 'session-2', 'session-1');
assert.deepEqual(action, { reload: false, sessionId: 'session-2' });
assert.equal(consumeSessionDirty(live, 'session-2'), true);
assert.equal(consumeSessionDirty(live, 'session-2'), false);
});
test('session live state reloads the visible session without leaving it dirty', () => {
const live = createSessionLiveState();
const action = noteSessionUpdated(live, 'session-1', 'session-1');
assert.deepEqual(action, { reload: true, sessionId: 'session-1' });
assert.equal(consumeSessionDirty(live, 'session-1'), false);
});