Files
SubMiner/src/stats-transport-architecture.test.ts
T
sudacode 83fffe533a refactor: split anki-connect and stats-server resolvers into modules
- Break src/config/resolve/anki-connect.ts into focused resolvers under anki-connect/ (initialize, known-words, legacy, modern, shared)
- Break src/core/services/stats-server.ts into route groups under stats-server/ (analytics, integration, library, mining, static, shared support)
- Add route-group and resolver isolation tests
- Update docs/architecture/domains.md to reflect new module layout
2026-07-15 22:58:55 -07:00

37 lines
1.2 KiB
TypeScript

import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import test from 'node:test';
const root = process.cwd();
function read(relativePath: string): string {
return fs.readFileSync(path.join(root, relativePath), 'utf8');
}
test('stats data uses the shared HTTP contract while native dialogs retain IPC', () => {
assert.equal(fs.existsSync(path.join(root, 'stats/src/lib/ipc-client.ts')), false);
const preload = read('src/preload-stats.ts');
assert.doesNotMatch(preload, /statsGet[A-Z]/);
assert.match(preload, /statsNativeConfirmDialog/);
const ipcContracts = read('src/shared/ipc/contracts.ts');
assert.doesNotMatch(ipcContracts, /statsGet[A-Z]/);
const ipcHandlers = read('src/core/services/ipc.ts');
assert.doesNotMatch(ipcHandlers, /statsGet[A-Z]/);
const apiClient = read('stats/src/lib/api-client.ts');
const statsServerRoutes = [
'analytics-routes.ts',
'integration-routes.ts',
'library-routes.ts',
'mining-routes.ts',
]
.map((filename) => read(`src/core/services/stats-server/${filename}`))
.join('\n');
assert.match(apiClient, /StatsHttpClient/);
assert.match(statsServerRoutes, /statsJson/);
});