← 教程列表
news

Task 4: Update tests for new structure

📅 2026/6/12 16:30:02⏱ 约 5 分钟阅读👁 7 阅读

**Files:** - Modify: `tests/brainstorm-server/server.test.js` **Note:** Line references below are from the _original_ file. Task 2 inserted new tests earlier in the file, so actual line numbers will be shifted. Find tests by their `console.log` labels (e.g., "Test 5:", "Test 6:"). - [ ] **Step 1: Update Test 5 (full document assertion)** Find the Test 5 assertion `!fullRes.body.includes('feedback-footer')`. Change it to: Full documents should NOT have the indicator bar either (they're served as-is): ```javascript assert(!fullRes.body.includes('indicator-bar') || fullDoc.includes('indicator-bar'), 'Should not wrap full documents in frame template'); ``` - [ ] **Step 2: Update Test 6 (fragment wrapping)** Line 125: Replace `feedback-footer` assertion with indicator bar assertion: ```javascript assert(fragRes.body.includes('indicator-bar'), 'Fragment should get indicator bar from frame'); ``` Also verify content placeholder was replaced (fragment content appears, placeholder comment doesn't): ```javascript assert(!fragRes.body.includes(''), 'Content placeholder should be replaced'); ``` - [ ] **Step 3: Update Test 7 (helper.js API)** Lines 140-142: Update assertions to reflect the new API surface: ```javascript assert(helperContent.includes('toggleSelect'), 'helper.js should define toggleSelect'); assert(helperContent.includes('sendEvent'), 'helper.js should define sendEvent'); assert(helperContent.includes('selectedChoice'), 'helper.js should track selectedChoice'); assert(helperContent.includes('brainstorm'), 'helper.js should expose brainstorm API'); assert(!helperContent.includes('sendToClaude'), 'helper.js should not contain sendToClaude'); ``` - [ ] **Step 4: Replace Test 8 (sendToClaude theming) with indicator bar test** Replace Test 8 (lines 145-149) — `sendToClaude` no longer exists. Test the indicator bar instead: ```javascript // Test 8: Indicator bar uses CSS variables (theme support) console.log('Test 8: Indicator bar uses CSS variables'); const templateContent = fs.readFileSync( path.join(__dirname, '../../lib/brainstorm-server/frame-template.html'), 'utf-8' ); assert(templateContent.includes('indicator-bar'), 'Template should have indicator bar'); assert(templateContent.includes('indicator-text'), 'Template should have indicator text element'); console.log(' PASS'); ``` - [ ] **Step 5: Run full test suite** ```bash cd /Users/drewritter/prime-rad/superpowers && node tests/brainstorm-server/server.test.js ``` Expected: ALL tests PASS. - [ ] **Step 6: Commit** ```bash git add tests/brainstorm-server/server.test.js git commit -m "Update brainstorm server tests for new template structure and helper.js API" ``` ---

← 返回教程列表 AI8899 · 内容仅供学习参考