TestBuildSafeOutputsSection validates that buildSafeOutputsSection generates safe-output names that are all valid according to the JSON schema.
(t *testing.T)
| 48 | // TestBuildSafeOutputsSection validates that buildSafeOutputsSection generates |
| 49 | // safe-output names that are all valid according to the JSON schema. |
| 50 | func TestBuildSafeOutputsSection(t *testing.T) { |
| 51 | section := buildSafeOutputsSection() |
| 52 | |
| 53 | require.NotEmpty(t, section, "buildSafeOutputsSection should return non-empty content") |
| 54 | assert.Contains(t, section, "safe-outputs:", "Section should contain safe-outputs key") |
| 55 | assert.Contains(t, section, "create-issue:", "Section should include create-issue as active example") |
| 56 | |
| 57 | // Get valid schema keys to check against |
| 58 | validKeys, err := parser.GetSafeOutputTypeKeys() |
| 59 | require.NoError(t, err, "GetSafeOutputTypeKeys should not return error") |
| 60 | require.NotEmpty(t, validKeys, "Schema should have safe output type keys") |
| 61 | |
| 62 | validKeySet := make(map[string]bool, len(validKeys)) |
| 63 | for _, k := range validKeys { |
| 64 | validKeySet[k] = true |
| 65 | } |
| 66 | |
| 67 | for _, key := range extractSafeOutputKeys(section) { |
| 68 | assert.True(t, validKeySet[key], |
| 69 | "safe-output name %q used in 'new' template is not a valid schema key", key) |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | // TestCreateWorkflowTemplateContainsOnlyValidSafeOutputs validates that the workflow |
| 74 | // template generated by the 'new' command only references safe-output names that are |
nothing calls this directly
no test coverage detected