11import { TEST_USER_ID } from '@codebuff/common/old-constants'
2+ import { TEST_AGENT_RUNTIME_IMPL } from '@codebuff/common/testing/impl/agent-runtime'
23import {
34 clearMockedModules ,
45 mockModule ,
@@ -9,14 +10,9 @@ import { applyPatch } from 'diff'
910
1011import { processFileBlock } from '../process-file-block'
1112
12- import type { Logger } from '@codebuff/common/types/contracts/logger '
13+ import type { AgentRuntimeDeps } from '@codebuff/common/types/contracts/agent-runtime '
1314
14- const logger : Logger = {
15- debug : ( ) => { } ,
16- info : ( ) => { } ,
17- warn : ( ) => { } ,
18- error : ( ) => { } ,
19- }
15+ let agentRuntimeImpl : AgentRuntimeDeps = { ...TEST_AGENT_RUNTIME_IMPL }
2016
2117describe ( 'processFileBlockModule' , ( ) => {
2218 beforeAll ( ( ) => {
@@ -74,6 +70,7 @@ describe('processFileBlockModule', () => {
7470 const expectedContent = 'function test() {\n return true;\n}'
7571
7672 const result = await processFileBlock ( {
73+ ...agentRuntimeImpl ,
7774 path : 'test.ts' ,
7875 instructions : undefined ,
7976 initialContentPromise : Promise . resolve ( null ) ,
@@ -85,7 +82,6 @@ describe('processFileBlockModule', () => {
8582 fingerprintId : 'fingerprintId' ,
8683 userInputId : 'userInputId' ,
8784 userId : TEST_USER_ID ,
88- logger,
8985 } )
9086
9187 expect ( result ) . not . toBeNull ( )
@@ -111,6 +107,7 @@ describe('processFileBlockModule', () => {
111107 '}\r\n'
112108
113109 const result = await processFileBlock ( {
110+ ...agentRuntimeImpl ,
114111 path : 'test.ts' ,
115112 instructions : undefined ,
116113 initialContentPromise : Promise . resolve ( oldContent ) ,
@@ -122,7 +119,6 @@ describe('processFileBlockModule', () => {
122119 fingerprintId : 'fingerprintId' ,
123120 userInputId : 'userInputId' ,
124121 userId : TEST_USER_ID ,
125- logger,
126122 } )
127123
128124 expect ( result ) . not . toBeNull ( )
@@ -144,6 +140,7 @@ describe('processFileBlockModule', () => {
144140 const newContent = 'function test() {\n return true;\n}\n'
145141
146142 const result = await processFileBlock ( {
143+ ...agentRuntimeImpl ,
147144 path : 'test.ts' ,
148145 instructions : undefined ,
149146 initialContentPromise : Promise . resolve ( oldContent ) ,
@@ -155,7 +152,6 @@ describe('processFileBlockModule', () => {
155152 fingerprintId : 'fingerprintId' ,
156153 userInputId : 'userInputId' ,
157154 userId : TEST_USER_ID ,
158- logger,
159155 } )
160156
161157 expect ( result ) . not . toBeNull ( )
@@ -170,6 +166,7 @@ describe('processFileBlockModule', () => {
170166 const newContent = 'const x = 1;\r\nconst z = 3;\r\n'
171167
172168 const result = await processFileBlock ( {
169+ ...agentRuntimeImpl ,
173170 path : 'test.ts' ,
174171 instructions : undefined ,
175172 initialContentPromise : Promise . resolve ( oldContent ) ,
@@ -181,7 +178,6 @@ describe('processFileBlockModule', () => {
181178 fingerprintId : 'fingerprintId' ,
182179 userInputId : 'userInputId' ,
183180 userId : TEST_USER_ID ,
184- logger,
185181 } )
186182
187183 expect ( result ) . not . toBeNull ( )
@@ -217,6 +213,7 @@ describe('processFileBlockModule', () => {
217213 '// ... existing code ...\nconst x = 1;\n// ... existing code ...'
218214
219215 const result = await processFileBlock ( {
216+ ...agentRuntimeImpl ,
220217 path : 'test.ts' ,
221218 instructions : undefined ,
222219 initialContentPromise : Promise . resolve ( null ) ,
@@ -228,7 +225,6 @@ describe('processFileBlockModule', () => {
228225 fingerprintId : 'fingerprintId' ,
229226 userInputId : 'userInputId' ,
230227 userId : TEST_USER_ID ,
231- logger,
232228 } )
233229
234230 expect ( result ) . not . toBeNull ( )
0 commit comments