(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestMissingToolSafeOutput(t *testing.T) { |
| 11 | tests := []struct { |
| 12 | name string |
| 13 | frontmatter map[string]any |
| 14 | expectConfig bool |
| 15 | expectJob bool |
| 16 | expectMax int |
| 17 | }{ |
| 18 | { |
| 19 | name: "No safe-outputs config should NOT enable missing-tool by default", |
| 20 | frontmatter: map[string]any{"name": "Test"}, |
| 21 | expectConfig: false, |
| 22 | expectJob: false, |
| 23 | expectMax: 0, |
| 24 | }, |
| 25 | { |
| 26 | name: "Safe-outputs with other config should enable missing-tool by default", |
| 27 | frontmatter: map[string]any{ |
| 28 | "name": "Test", |
| 29 | "safe-outputs": map[string]any{ |
| 30 | "create-issue": nil, |
| 31 | }, |
| 32 | }, |
| 33 | expectConfig: true, |
| 34 | expectJob: true, |
| 35 | expectMax: 0, |
| 36 | }, |
| 37 | { |
| 38 | name: "Explicit missing-tool: false should disable it", |
| 39 | frontmatter: map[string]any{ |
| 40 | "name": "Test", |
| 41 | "safe-outputs": map[string]any{ |
| 42 | "create-issue": nil, |
| 43 | "missing-tool": false, |
| 44 | }, |
| 45 | }, |
| 46 | expectConfig: false, |
| 47 | expectJob: false, |
| 48 | expectMax: 0, |
| 49 | }, |
| 50 | { |
| 51 | name: "Explicit missing-tool config with max", |
| 52 | frontmatter: map[string]any{ |
| 53 | "name": "Test", |
| 54 | "safe-outputs": map[string]any{ |
| 55 | "missing-tool": map[string]any{ |
| 56 | "max": 5, |
| 57 | }, |
| 58 | }, |
| 59 | }, |
| 60 | expectConfig: true, |
| 61 | expectJob: true, |
| 62 | expectMax: 5, |
| 63 | }, |
| 64 | { |
| 65 | name: "Missing-tool with other safe outputs", |
| 66 | frontmatter: map[string]any{ |
| 67 | "name": "Test", |
nothing calls this directly
no test coverage detected