From 2d39a91aed53ecfb8f2106a6263ceb43acaf7a67 Mon Sep 17 00:00:00 2001 From: wujunchen Date: Wed, 29 Apr 2026 13:53:19 +0800 Subject: [PATCH] test: split architecture guard tests Change-Id: Ibde4ae79f202ae0e26658ab47bbcf5b52ef9effe --- tests/{main.test.js => architecture.test.js} | 46 +------------------- tests/test-exports.test.js | 45 +++++++++++++++++++ 2 files changed, 47 insertions(+), 44 deletions(-) rename tests/{main.test.js => architecture.test.js} (66%) create mode 100644 tests/test-exports.test.js diff --git a/tests/main.test.js b/tests/architecture.test.js similarity index 66% rename from tests/main.test.js rename to tests/architecture.test.js index 9c0efb4..9d74973 100644 --- a/tests/main.test.js +++ b/tests/architecture.test.js @@ -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'); diff --git a/tests/test-exports.test.js b/tests/test-exports.test.js new file mode 100644 index 0000000..ba508a4 --- /dev/null +++ b/tests/test-exports.test.js @@ -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');