From fa95a463f824356c005437b44c0776920158d936 Mon Sep 17 00:00:00 2001 From: Jeffery Date: Tue, 16 Jun 2026 17:00:29 +0800 Subject: [PATCH] =?UTF-8?q?test(roles):=20=E8=A3=9C=20focus/personality=20?= =?UTF-8?q?=E7=BC=BA=E6=BC=8F=E6=99=82=E7=9A=84=E8=BC=B8=E5=87=BA=E9=98=B2?= =?UTF-8?q?=E8=AD=B7=E6=B8=AC=E8=A9=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/roles.test.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/roles.test.js b/app/roles.test.js index 54d5c79..b700a38 100644 --- a/app/roles.test.js +++ b/app/roles.test.js @@ -72,6 +72,11 @@ describe('buildAnalysisPrompt', () => { assert.match(prompt, /審查重點:邊界與空值/); assert.match(prompt, /只回傳 JSON 陣列/); }); + + it('falls back to a default when focus is missing instead of showing undefined', () => { + const prompt = buildAnalysisPrompt({ name: 'NoFocus', body: 'x' }); + assert.doesNotMatch(prompt, /undefined/); + }); }); describe('getRoleIntro', () => { @@ -80,4 +85,10 @@ describe('getRoleIntro', () => { assert.match(intro, /🔮 Tester/); assert.match(intro, /logic/); }); + + it('renders empty cells instead of undefined when focus/personality are missing', () => { + const intro = getRoleIntro([{ name: 'Bare' }]); + assert.match(intro, /Bare/); + assert.doesNotMatch(intro, /undefined/); + }); });