TestBuildAWFConfigJSON_ValidateFlag verifies that schema validation runs when WorkflowData.ValidateAWFConfig is true (--validate mode) and is skipped otherwise.
(t *testing.T)
| 1205 | // TestBuildAWFConfigJSON_ValidateFlag verifies that schema validation runs when |
| 1206 | // WorkflowData.ValidateAWFConfig is true (--validate mode) and is skipped otherwise. |
| 1207 | func TestBuildAWFConfigJSON_ValidateFlag(t *testing.T) { |
| 1208 | t.Run("validation runs when ValidateAWFConfig is true", func(t *testing.T) { |
| 1209 | config := AWFCommandConfig{ |
| 1210 | EngineName: "copilot", |
| 1211 | AllowedDomains: "github.com", |
| 1212 | WorkflowData: &WorkflowData{ |
| 1213 | EngineConfig: &EngineConfig{ID: "copilot"}, |
| 1214 | ValidateAWFConfig: true, |
| 1215 | }, |
| 1216 | } |
| 1217 | _, err := BuildAWFConfigJSON(config) |
| 1218 | require.NoError(t, err, "valid config with ValidateAWFConfig=true should not error") |
| 1219 | }) |
| 1220 | |
| 1221 | t.Run("validation is skipped when ValidateAWFConfig is false", func(t *testing.T) { |
| 1222 | config := AWFCommandConfig{ |
| 1223 | EngineName: "copilot", |
| 1224 | AllowedDomains: "github.com", |
| 1225 | WorkflowData: &WorkflowData{ |
| 1226 | EngineConfig: &EngineConfig{ID: "copilot"}, |
| 1227 | ValidateAWFConfig: false, |
| 1228 | }, |
| 1229 | } |
| 1230 | _, err := BuildAWFConfigJSON(config) |
| 1231 | require.NoError(t, err, "valid config with ValidateAWFConfig=false should not error") |
| 1232 | }) |
| 1233 | |
| 1234 | t.Run("validation is skipped when WorkflowData is nil", func(t *testing.T) { |
| 1235 | config := AWFCommandConfig{ |
| 1236 | EngineName: "copilot", |
| 1237 | AllowedDomains: "github.com", |
| 1238 | WorkflowData: nil, |
| 1239 | } |
| 1240 | _, err := BuildAWFConfigJSON(config) |
| 1241 | require.NoError(t, err, "valid config with nil WorkflowData should not error") |
| 1242 | }) |
| 1243 | } |
| 1244 | |
| 1245 | func TestSplitDomainList(t *testing.T) { |
| 1246 | tests := []struct { |
nothing calls this directly
no test coverage detected