From 957f91fc6d5a30095e773407420184ee2e749678 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 13 Sep 2026 17:28:18 +0000 Subject: [PATCH] test: drop tautological production host pin Empty env must not silently point at staging. Compare load() to the named production constants instead of restating the hostname literal. Document the same rule in AGENTS.md. Co-authored-by: Fang-Pen Lin --- AGENTS.md | 6 ++++++ src/config.rs | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 3c57070..d33f464 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -28,6 +28,12 @@ Keep the public command surface stable. Docs and examples call `amendable`, not ## Tests +Do not add tautological tests that only assert a default host, constant, or +constructor dump equals the literal you just set. If changing an intended +default requires updating the test, and the test never exercises behavior, +omit it. Test env/file override, staging vs production selection, and CLI +contracts instead. + ```bash cargo test cargo fmt --check diff --git a/src/config.rs b/src/config.rs index 779f785..12bd6d8 100644 --- a/src/config.rs +++ b/src/config.rs @@ -167,9 +167,10 @@ mod tests { env::remove_var("AMENDABLE_TOKEN"); env::remove_var("AMENDABLE_USERNAME"); let cfg = Config::load().unwrap(); + assert_ne!(cfg.api_url, STAGING_API_URL); + assert_ne!(cfg.app_url, STAGING_APP_URL); assert_eq!(cfg.api_url, DEFAULT_API_URL); assert_eq!(cfg.app_url, DEFAULT_APP_URL); - assert_eq!(cfg.api_url, "https://api.amendable.io"); } #[test]