File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -348,6 +348,7 @@ impl UniffiCustomTypeConverter for NodeAlias {
348348
349349/// Represents the description of an invoice which has to be either a directly included string or
350350/// a hash of a description provided out of band.
351+ #[ derive( Debug , Clone , PartialEq , Eq ) ]
351352pub enum Bolt11InvoiceDescription {
352353 /// Contains a full description.
353354 Direct {
@@ -391,3 +392,17 @@ impl From<lightning_invoice::Bolt11InvoiceDescription> for Bolt11InvoiceDescript
391392 }
392393 }
393394}
395+
396+ #[ cfg( test) ]
397+ mod tests {
398+ use super :: * ;
399+ #[ test]
400+ fn test_invoice_description_conversion ( ) {
401+ let hash = "09d08d4865e8af9266f6cc7c0ae23a1d6bf868207cf8f7c5979b9f6ed850dfb0" . to_string ( ) ;
402+ let description = Bolt11InvoiceDescription :: Hash { hash } ;
403+ let converted_description =
404+ lightning_invoice:: Bolt11InvoiceDescription :: try_from ( & description) . unwrap ( ) ;
405+ let reconverted_description: Bolt11InvoiceDescription = converted_description. into ( ) ;
406+ assert_eq ! ( description, reconverted_description) ;
407+ }
408+ }
You can’t perform that action at this time.
0 commit comments