@@ -67,7 +67,13 @@ describe('AnthropicClient', () => {
6767 const callArgs = ( global . fetch as any ) . mock . calls [ 0 ] [ 1 ]
6868 const body = JSON . parse ( callArgs . body )
6969
70- expect ( body . system ) . toBe ( 'You are a helpful assistant' )
70+ expect ( body . system ) . toEqual ( [
71+ {
72+ type : 'text' ,
73+ text : 'You are a helpful assistant' ,
74+ cache_control : { type : 'ephemeral' }
75+ }
76+ ] )
7177 expect ( body . messages ) . toHaveLength ( 1 )
7278 expect ( body . messages [ 0 ] . role ) . toBe ( 'user' )
7379 } )
@@ -148,7 +154,13 @@ describe('AnthropicClient', () => {
148154 const callArgs = ( global . fetch as any ) . mock . calls [ 0 ] [ 1 ]
149155 const body = JSON . parse ( callArgs . body )
150156
151- expect ( body . system ) . toContain ( 'JSON' )
157+ expect ( body . system ) . toEqual ( [
158+ {
159+ type : 'text' ,
160+ text : '请以有效的JSON格式提供响应。' ,
161+ cache_control : { type : 'ephemeral' }
162+ }
163+ ] )
152164 } )
153165
154166 it ( 'should append JSON instruction to existing system prompt' , async ( ) => {
@@ -173,8 +185,13 @@ describe('AnthropicClient', () => {
173185 const callArgs = ( global . fetch as any ) . mock . calls [ 0 ] [ 1 ]
174186 const body = JSON . parse ( callArgs . body )
175187
176- expect ( body . system ) . toContain ( 'You are helpful' )
177- expect ( body . system ) . toContain ( 'JSON' )
188+ expect ( body . system ) . toEqual ( [
189+ {
190+ type : 'text' ,
191+ text : 'You are helpful\n\n请以有效的JSON格式提供响应。' ,
192+ cache_control : { type : 'ephemeral' }
193+ }
194+ ] )
178195 } )
179196 } )
180197
0 commit comments