test(client): construct immutable multi-block system fixture

The system message content is readonly. Build a replacement fixture value for the multi-block extraction test instead of assigning into a readonly message property. Preserve the exact behavioral assertion without weakening production types or adding a cast that hides mutation.

Validation: aggregate client build exposed TS2540 at the mutation; all seven system prompt interpretation tests pass with immutable fixture construction.
This commit is contained in:
Tianyi Cui committed 2026-09-07 11:09:40 +08:00
1 parent 84e94d8394
commit 99cffb4de7
1 file changed
+4 -2
@@ -73,8 +73,10 @@ describe('loaded system surface interpretation', () => {
it('extracts text blocks once and treats an empty initial node as no prompt', () => {
const event = system(1, 'A')
if (event.type !== 'system/message') throw new Error('expected system event')
event.data.message.content = [{ type: 'text', text: 'A' }, { type: 'text', text: 'B' }]
expect(inspectSystemPrompt(undefined, event).effective?.text).toBe('AB')
const multiBlock = { ...event, data: { ...event.data, message: {
...event.data.message, content: [{ type: 'text' as const, text: 'A' }, { type: 'text' as const, text: 'B' }],
} } }
expect(inspectSystemPrompt(undefined, multiBlock).effective?.text).toBe('AB')
expect(inspectSystemPrompt(undefined, system(2, '')).effective).toBeUndefined()
})
})