1- import { describe , it , expect , beforeEach } from 'bun:test'
1+ import { describe , it , expect } from 'bun:test'
22
33import type { WebSocket } from 'ws'
44
55describe ( 'Backend Tool Call Schema' , ( ) => {
6- let mockWs : any
7-
8- beforeEach ( ( ) => {
9- // Create a simple mock WebSocket
10- mockWs = {
11- send : ( ) => { } ,
12- on : ( ) => { } ,
13- close : ( ) => { } ,
14- }
15- } )
16-
176 it ( 'should validate tool call request structure' , ( ) => {
187 const toolCallRequest = {
198 type : 'tool-call-request' as const ,
@@ -109,26 +98,23 @@ describe('Backend Tool Call Schema', () => {
10998 } )
11099
111100 it ( 'should generate mock project structure analysis' , async ( ) => {
112- const analysis = await generateMockProjectStructureAnalysis ( mockWs )
101+ const analysis = await generateMockProjectStructureAnalysis ( )
113102
114103 expect ( analysis ) . toContain ( '## Project Analysis' )
115104 expect ( analysis ) . toContain ( 'TypeScript/JavaScript/JSON files' )
116105 expect ( typeof analysis ) . toBe ( 'string' )
117106 } )
118107
119108 it ( 'should generate mock dependency analysis' , async ( ) => {
120- const analysis = await generateMockDependencyAnalysis ( mockWs )
109+ const analysis = await generateMockDependencyAnalysis ( )
121110
122111 expect ( analysis ) . toContain ( '## Dependency Analysis' )
123112 expect ( analysis ) . toContain ( 'Declared Dependencies' )
124113 expect ( typeof analysis ) . toBe ( 'string' )
125114 } )
126115
127116 it ( 'should handle error scenarios in mock generators' , async ( ) => {
128- const errorAnalysis = await generateMockProjectStructureAnalysis (
129- mockWs ,
130- true ,
131- )
117+ const errorAnalysis = await generateMockProjectStructureAnalysis ( true )
132118
133119 expect ( errorAnalysis ) . toContain ( 'Project analysis failed' )
134120 expect ( typeof errorAnalysis ) . toBe ( 'string' )
@@ -141,7 +127,6 @@ describe('Backend Tool Call Schema', () => {
141127 * based on the current context or user request
142128 */
143129export async function generateMockProjectStructureAnalysis (
144- ws : WebSocket ,
145130 simulateError : boolean = false ,
146131) : Promise < string > {
147132 try {
@@ -228,7 +213,6 @@ export async function generateMockProjectStructureAnalysis(
228213 * Dynamically searches for imports and analyzes dependencies
229214 */
230215export async function generateMockDependencyAnalysis (
231- ws : WebSocket ,
232216 searchPattern ?: string ,
233217) : Promise < string > {
234218 try {
0 commit comments