(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestToolToJsDoc(t *testing.T) { |
| 12 | t.Parallel() |
| 13 | type CreateTodoArgs struct { |
| 14 | Description string `json:"description" jsonschema:"Description of the todo item"` |
| 15 | } |
| 16 | |
| 17 | tool := tools.Tool{ |
| 18 | Name: "create_todo", |
| 19 | Description: "Create new todo\n each of them with a description", |
| 20 | Parameters: tools.MustSchemaFor[CreateTodoArgs](), |
| 21 | OutputSchema: tools.MustSchemaFor[string](), |
| 22 | } |
| 23 | |
| 24 | jsDoc := toolToJsDoc(tool) |
| 25 | |
| 26 | assert.Equal(t, ` |
| 27 | /** |
| 28 | * Create new todo |
| 29 | * each of them with a description |
| 30 | * |
| 31 | * @param args - Input object containing the parameters. |
| 32 | * @returns Output - The result of the function execution. |
| 33 | * |
| 34 | * Where Input follows the following JSON schema: |
| 35 | * { |
| 36 | * "type": "object", |
| 37 | * "properties": { |
| 38 | * "description": { |
| 39 | * "type": "string", |
| 40 | * "description": "Description of the todo item" |
| 41 | * } |
| 42 | * }, |
| 43 | * "required": [ |
| 44 | * "description" |
| 45 | * ], |
| 46 | * "additionalProperties": false |
| 47 | * } |
| 48 | * |
| 49 | * And Output follows the following JSON schema: |
| 50 | * { |
| 51 | * "type": "string" |
| 52 | * } |
| 53 | */ |
| 54 | function create_todo(args: Input): Output { ... } |
| 55 | `, jsDoc) |
| 56 | } |
nothing calls this directly
no test coverage detected