MCPcopy Create free account
hub / github.com/github/gh-aw / TestParseInputDefinition

Function TestParseInputDefinition

pkg/workflow/inputs_test.go:12–134  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestParseInputDefinition(t *testing.T) {
13 tests := []struct {
14 name string
15 config map[string]any
16 expected *InputDefinition
17 }{
18 {
19 name: "full input definition",
20 config: map[string]any{
21 "description": "Target deployment environment",
22 "required": true,
23 "type": "choice",
24 "default": "staging",
25 "options": []any{"staging", "production"},
26 },
27 expected: &InputDefinition{
28 Description: "Target deployment environment",
29 Required: true,
30 Type: "choice",
31 Default: "staging",
32 Options: []string{"staging", "production"},
33 },
34 },
35 {
36 name: "minimal input definition",
37 config: map[string]any{
38 "description": "Simple input",
39 },
40 expected: &InputDefinition{
41 Description: "Simple input",
42 },
43 },
44 {
45 name: "boolean type with default",
46 config: map[string]any{
47 "description": "Enable debug mode",
48 "type": "boolean",
49 "default": false,
50 "required": false,
51 },
52 expected: &InputDefinition{
53 Description: "Enable debug mode",
54 Type: "boolean",
55 Default: false,
56 Required: false,
57 },
58 },
59 {
60 name: "number type with default",
61 config: map[string]any{
62 "description": "Number of items to fetch",
63 "type": "number",
64 "default": 100,
65 },
66 expected: &InputDefinition{
67 Description: "Number of items to fetch",
68 Type: "number",
69 Default: 100,

Callers

nothing calls this directly

Calls 3

ParseInputDefinitionFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected