Browse Source

mint error test

thesimplekid 1 năm trước cách đây
mục cha
commit
b5d52dde2a
1 tập tin đã thay đổi với 20 bổ sung0 xóa
  1. 20 0
      src/client.rs

+ 20 - 0
src/client.rs

@@ -287,3 +287,23 @@ impl Client {
         }
     }
 }
+
+#[cfg(test)]
+mod tests {
+
+    use super::*;
+
+    #[test]
+    fn test_decode_error() {
+        let err = r#"{"code":0,"error":"Lightning invoice not paid yet."}"#;
+
+        let error = Error::from_json(err).unwrap();
+
+        match error {
+            Error::InvoiceNotPaid => {}
+            _ => panic!("Wrong error"),
+        }
+
+        // assert_eq!(error, Error::InvoiceNotPaid);
+    }
+}