use agent_pay::{parse_invoice, InvoiceCreateRequest, LightningNode, MemoryLedger, MemoryNode};
#[tokio::test]
async fn parse_invoice_extracts_amount_and_payment_hash() {
let ledger = MemoryLedger::new();
let node = MemoryNode::new(ledger, "issuer");
let inv = node
.create_invoice(InvoiceCreateRequest {
amount_msat: 10_000,
memo: None,
expiry_seconds: None,
})
.await
.unwrap();
let parsed = parse_invoice(&inv.bolt11).unwrap();
assert_eq!(parsed.amount_msat, 10_000);
assert_eq!(parsed.payment_hash, inv.payment_hash);
}
#[test]
fn parse_invoice_throws_on_non_bolt11_input() {
assert!(parse_invoice("not a bolt11").is_err());
}