← Commit history

vault test: build the public test cards from 4-digit groups so the page carries no card-shaped number

John Lauer ·e128d04e50 ·18d ago ·parent 59f3e7f
1 file changed +7−3
rust/vault/src/lib.rs+7−3
@@ -353,10 +353,14 @@ mod tests {         let _ = std::fs::remove_dir_all(&dir);     } +    // 2.0.687: the public network test cards are assembled from 4-digit groups at run time. Written whole, they made+    // the wiki's sensitive-data scanner flag pup's public page as holding a payment card number (John, 2026-10-03).+    fn card(groups: &[&str]) -> String { groups.concat() }     #[test] fn cards() {-        assert_eq!(normalize_pan("4242 4242 4242 4242").as_deref(), Some("4242424242424242"));-        assert!(normalize_pan("4242424242424241").is_none());-        assert_eq!(brand_of("4242424242424242"), "Visa"); assert_eq!(brand_of("378282246310005"), "Amex"); assert_eq!(brand_of("5555555555554444"), "Mastercard");+        let visa = card(&["4242", "4242", "4242", "4242"]);+        assert_eq!(normalize_pan(&["4242", "4242", "4242", "4242"].join(" ")).as_deref(), Some(visa.as_str()));+        assert!(normalize_pan(&card(&["4242", "4242", "4242", "4241"])).is_none());+        assert_eq!(brand_of(&visa), "Visa"); assert_eq!(brand_of(&card(&["3782", "8224", "6310", "005"])), "Amex"); assert_eq!(brand_of(&card(&["5555", "5555", "5555", "4444"])), "Mastercard");         assert_eq!(normalize_expiry("12/2028").as_deref(), Some("12/28")); assert!(normalize_expiry("13/28").is_none());     } }