(t *testing.T)
| 26 | ) |
| 27 | |
| 28 | func TestToolsetConfig_Initialize(t *testing.T) { |
| 29 | t.Parallel() |
| 30 | |
| 31 | var tool1 = testutils.NewMockTool("tool1", "some description", []parameters.Parameter{}, false, false) |
| 32 | var tool2 = testutils.NewMockTool( |
| 33 | "tool2", |
| 34 | "some description", |
| 35 | parameters.Parameters{ |
| 36 | parameters.NewIntParameter("param1", "This is the first parameter."), |
| 37 | parameters.NewIntParameter("param2", "This is the second parameter."), |
| 38 | }, false, false) |
| 39 | |
| 40 | toolsMap := map[string]tools.Tool{ |
| 41 | "tool1": tool1, |
| 42 | "tool2": tool2, |
| 43 | } |
| 44 | serverVersion := "test-version" |
| 45 | |
| 46 | t1 := toolsMap["tool1"] |
| 47 | t2 := toolsMap["tool2"] |
| 48 | tool1Ptr := &t1 |
| 49 | tool2Ptr := &t2 |
| 50 | |
| 51 | testCases := []struct { |
| 52 | name string |
| 53 | config tools.ToolsetConfig |
| 54 | want tools.Toolset |
| 55 | wantErr string |
| 56 | }{ |
| 57 | { |
| 58 | name: "Success case", |
| 59 | config: tools.ToolsetConfig{ |
| 60 | Name: "default", |
| 61 | ToolNames: []string{"tool1", "tool2"}, |
| 62 | }, |
| 63 | want: tools.Toolset{ |
| 64 | ToolsetConfig: tools.ToolsetConfig{ |
| 65 | Name: "default", |
| 66 | ToolNames: []string{"tool1", "tool2"}, |
| 67 | }, |
| 68 | Tools: []*tools.Tool{ |
| 69 | tool1Ptr, |
| 70 | tool2Ptr, |
| 71 | }, |
| 72 | Manifest: tools.ToolsetManifest{ |
| 73 | ServerVersion: serverVersion, |
| 74 | }, |
| 75 | }, |
| 76 | wantErr: "", |
| 77 | }, |
| 78 | { |
| 79 | name: "Success case with one tool", |
| 80 | config: tools.ToolsetConfig{ |
| 81 | Name: "single", |
| 82 | ToolNames: []string{"tool1"}, |
| 83 | }, |
| 84 | want: tools.Toolset{ |
| 85 | ToolsetConfig: tools.ToolsetConfig{ |
nothing calls this directly
no test coverage detected