test: split architecture guard tests

Change-Id: Ibde4ae79f202ae0e26658ab47bbcf5b52ef9effe
This commit is contained in:
wujunchen 2026-04-29 13:53:19 +08:00
parent 39ddd4289e
commit 2d39a91aed
2 changed files with 47 additions and 44 deletions

View file

@ -4,7 +4,7 @@
*/
const fs = require('fs');
const path = require('path');
const { assert, t } = require('./test-setup');
const { assert } = require('./test-setup');
const mainSource = fs.readFileSync(path.join(__dirname, '..', 'main.ts'), 'utf8');
const viewSource = fs.readFileSync(path.join(__dirname, '..', 'src', 'view.ts'), 'utf8');
@ -39,46 +39,4 @@ assert.ok(!/function addIconButton/.test(mainSource), 'UI icon helper should liv
assert.ok(!/function addTextButton/.test(mainSource), 'UI text-button helper should live outside main.ts');
assert.ok(!/function copyToClipboard/.test(mainSource), 'clipboard helper should live outside main.ts');
// Export surface smoke test
const expectedExports = [
'cardsToMarkdown',
'cancellationNoticeKey',
'summarizeDocument',
'addIconButton',
'addTextButton',
'copyToClipboard',
'resolveCliPath',
'runCli',
'buildPrompts',
'buildOpenAiChatBody',
'extractJson',
'findLineForAnchor',
'folderPathsForTarget',
'getApiBaseUrl',
'generationFingerprint',
'hasUnsafeBatchFolderSegments',
'CacheManager',
'GenerationJobManager',
'createBatchRunState',
'modelForApi',
'activeSectionLine',
'touchCacheEntry',
'nextCardIndex',
'pruneCacheEntries',
'removeCardAt',
'activeIndexAfterCardDelete',
'createRafThrottledHandler',
'visibleTopProbeY',
'serializeCacheFile',
'shouldConfirmRegenerate',
'translate',
'updateCardAt',
'validateBatchFolderInput',
'normalizeSettings',
'normalizeStreamingTimeoutMs',
];
for (const name of expectedExports) {
assert.strictEqual(typeof t[name], 'function', `test-exports should include ${name}`);
}
console.log('tests passed');
console.log('architecture tests passed');

View file

@ -0,0 +1,45 @@
const { assert, t } = require('./test-setup');
const expectedExports = [
'cardsToMarkdown',
'cancellationNoticeKey',
'summarizeDocument',
'addIconButton',
'addTextButton',
'copyToClipboard',
'resolveCliPath',
'runCli',
'buildPrompts',
'buildOpenAiChatBody',
'extractJson',
'findLineForAnchor',
'folderPathsForTarget',
'getApiBaseUrl',
'generationFingerprint',
'hasUnsafeBatchFolderSegments',
'CacheManager',
'GenerationJobManager',
'createBatchRunState',
'modelForApi',
'activeSectionLine',
'touchCacheEntry',
'nextCardIndex',
'pruneCacheEntries',
'removeCardAt',
'activeIndexAfterCardDelete',
'createRafThrottledHandler',
'visibleTopProbeY',
'serializeCacheFile',
'shouldConfirmRegenerate',
'translate',
'updateCardAt',
'validateBatchFolderInput',
'normalizeSettings',
'normalizeStreamingTimeoutMs',
];
for (const name of expectedExports) {
assert.strictEqual(typeof t[name], 'function', `test-exports should include ${name}`);
}
console.log('test exports tests passed');