test(roles): 補 focus/personality 缺漏時的輸出防護測試
This commit is contained in:
@@ -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/);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user