Commit 9a202c20ec12f24ea7779ab611e3789dd5aa0e37

constantoine 2022-10-10T10:34:52

Fix coverage for secret.rs Signed-off-by: constantoine <cleo.rebert-ext@treezor.com>

diff --git a/src/secret.rs b/src/secret.rs
index 9ca6c2f..6edde97 100644
--- a/src/secret.rs
+++ b/src/secret.rs
@@ -237,19 +237,19 @@ mod tests {
     #[test]
     #[cfg(feature = "gen_secret")]
     fn secret_gen_secret() {
-        match Secret::generate_secret() {
-            Secret::Raw(secret) => assert_eq!(secret.len(), 20),
-            Secret::Encoded(_) => panic!("should be raw"),
-        }
+        let sec = Secret::generate_secret();
+
+        assert!(matches!(sec, Secret::Raw(_)));
+        assert_eq!(sec.to_bytes().unwrap().len(), 20);
     }
 
     #[test]
     #[cfg(feature = "gen_secret")]
     fn secret_gen_default() {
-        match Secret::default() {
-            Secret::Raw(secret) => assert_eq!(secret.len(), 20),
-            Secret::Encoded(_) => panic!("should be raw"),
-        }
+        let sec = Secret::default();
+
+        assert!(matches!(sec, Secret::Raw(_)));
+        assert_eq!(sec.to_bytes().unwrap().len(), 20);
     }
 
     #[test]