From 754adad1c0574451481bc674cc07720b0d34d52b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 22 May 2026 01:33:44 +0000 Subject: [PATCH] test: reduce and improve tests in src/compile/types.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove test_engine_config_id_defaults_to_copilot: duplicate of test_engine_config_full_object_partial_fields (both assert engine_id defaults to 'copilot' when id is omitted — identical coverage) - Fix test_azure_devops_not_set: was testing 'no tools field at all' (fm.tools.is_none()) instead of 'azure-devops absent within tools'; rewritten to match test_cache_memory_not_set pattern - Strengthen test_network_config_rejects_arbitrary_unknown_field: add error message assertion to match its sibling test - Strengthen test_lean_bool_false: add toolchain().is_none() assertion for complete state verification - Fix test_pr_trigger_config_combined_with_pipeline_trigger: replace vacuous tc.pipeline.is_some() / tc.pr.is_some() with value assertions on pipeline.name and the filter pattern Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/compile/types.rs | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/compile/types.rs b/src/compile/types.rs index aa1e9ec4..28c2b0f8 100644 --- a/src/compile/types.rs +++ b/src/compile/types.rs @@ -1553,14 +1553,7 @@ timeout-minutes: 60 assert_eq!(env.get("AWS_REGION").unwrap(), "us-west-2"); } - #[test] - fn test_engine_config_id_defaults_to_copilot() { - let yaml = "model: gpt-5\ntimeout-minutes: 30"; - let opts: EngineOptions = serde_yaml::from_str(yaml).unwrap(); - let ec = EngineConfig::Full(opts); - assert_eq!(ec.engine_id(), "copilot"); - assert_eq!(ec.model(), Some("gpt-5")); - } + // ─── PermissionsConfig deserialization ─────────────────────────────── @@ -1807,12 +1800,14 @@ Body let content = r#"--- name: "Test" description: "Test" +tools: + edit: true --- Body "#; let (fm, _) = super::super::common::parse_markdown(content).unwrap(); - assert!(fm.tools.is_none()); + assert!(fm.tools.as_ref().unwrap().azure_devops.is_none()); } #[test] @@ -1871,6 +1866,7 @@ Body let (fm, _) = super::super::common::parse_markdown(content).unwrap(); let lean = fm.runtimes.as_ref().unwrap().lean.as_ref().unwrap(); assert!(!lean.is_enabled()); + assert!(lean.toolchain().is_none()); } #[test] @@ -2010,6 +2006,12 @@ Body result.is_err(), "unknown fields in network should be rejected" ); + let err = format!("{:#}", result.unwrap_err()); + assert!( + err.contains("typo-field") || err.contains("unknown field"), + "error should mention the unknown field, got: {}", + err + ); } // ─── FrontMatter deny_unknown_fields ───────────────────────────────────── @@ -2281,8 +2283,10 @@ triggers: "#; let val: serde_yaml::Value = serde_yaml::from_str(yaml).unwrap(); let tc: OnConfig = serde_yaml::from_value(val["triggers"].clone()).unwrap(); - assert!(tc.pipeline.is_some()); - assert!(tc.pr.is_some()); + assert_eq!( + tc.pipeline.as_ref().unwrap().name, + "Build Pipeline" + ); assert_eq!( tc.pr.unwrap().filters.unwrap().title.unwrap().pattern, "*[review]*"