@@ -295,6 +295,97 @@ final class FunctionCallingAIProxySwiftTests: XCTestCase {
295295 }
296296 XCTAssertEqual ( enumValues, [ " option1 " , " option2 " ] )
297297 }
298+
299+ func testToDeepSeekTools( ) throws {
300+ let deepSeekTools = toolContainer. toDeepSeekTools ( )
301+
302+ XCTAssertEqual ( deepSeekTools. count, 1 )
303+
304+ let deepSeekTool = try XCTUnwrap ( deepSeekTools. first)
305+
306+ guard case . function( let name, let description, let parameters) = deepSeekTool else {
307+ XCTFail ( " Cannot unwrap function " )
308+ return
309+ }
310+
311+ // name
312+ XCTAssertEqual ( name, " testTool " )
313+ // description
314+ XCTAssertEqual ( description, " A test tool " )
315+
316+ // inputSchema
317+ guard let parameters else {
318+ XCTFail ( " Parameters should be a dictionary " )
319+ return
320+ }
321+
322+ // inputSchema.type
323+ guard case . string( let type) = parameters [ " type " ] else {
324+ XCTFail ( " Parameters should be a dictionary " )
325+ return
326+ }
327+ XCTAssertEqual ( type, " object " )
328+
329+ // inputSchema.requiredProperties
330+ guard case . array( let required) = parameters [ " required " ] else {
331+ XCTFail ( " Parameters should be a dictionary " )
332+ return
333+ }
334+
335+ let requiredProperties = required. compactMap { requiredProperty in
336+ switch requiredProperty {
337+ case . string( let propertyName) :
338+ return propertyName
339+ default :
340+ return nil
341+ }
342+ }
343+ XCTAssertEqual ( requiredProperties, [ " testParam " ] )
344+
345+ // inputSchema.properties
346+ guard case . object( let properties) = parameters [ " properties " ] else {
347+ XCTFail ( " Parameters should be a dictionary " )
348+ return
349+ }
350+ XCTAssertEqual ( properties. count, 1 )
351+
352+ // inputSchema.properties.testParam
353+ let testParam = try XCTUnwrap ( properties [ " testParam " ] )
354+
355+ guard case . object( let prop) = testParam else {
356+ XCTFail ( " Parameters should be a dictionary " )
357+ return
358+ }
359+
360+ guard case . string( let type) = prop [ " type " ] else {
361+ XCTFail ( " Parameters should be a dictionary " )
362+ return
363+ }
364+ XCTAssertEqual ( type, " string " )
365+
366+ guard case . string( let description) = prop [ " description " ] else {
367+ XCTFail ( " Parameters should be a dictionary " )
368+ return
369+ }
370+ XCTAssertEqual ( description, " A test parameter " )
371+
372+ guard case . array( let enumValueArray) = prop [ " enum " ] else {
373+ XCTFail ( " Parameters should be a dictionary " )
374+ return
375+ }
376+
377+ XCTAssertEqual ( enumValueArray. count, 2 )
378+
379+ let enumValues = enumValueArray. compactMap { enumValue in
380+ switch enumValue {
381+ case . string( let value) :
382+ return value
383+ default :
384+ return nil
385+ }
386+ }
387+ XCTAssertEqual ( enumValues, [ " option1 " , " option2 " ] )
388+ }
298389 // swiftlint:enable cyclomatic_complexity
299390 // swiftlint:enable function_body_length
300391}
0 commit comments