Restructure app into src/{main,preload,renderer}; electron.vite.config.ts builds
all three (each main module its own input so CJS requires + the indexer worker
resolve; better-sqlite3 externalized; Vue plugin for renderer). main/index.js
paths updated for the out/ layout + ELECTRON_RENDERER_URL. Still JS/CJS — TS+ESM
and core consumption are the next stages. Verified: npm run dev launches clean;
electron-vite build succeeds; root suite 119/119.
28 lines
937 B
JavaScript
28 lines
937 B
JavaScript
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
|
|
import {
|
|
createSessionLiveState,
|
|
consumeSessionDirty,
|
|
noteSessionUpdated,
|
|
} from '../app/src/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);
|
|
});
|