Skip to content

Commit

Permalink
Better test
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcaseria committed Aug 12, 2024
1 parent a050ee8 commit bd4fdd0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion crates/cdk/src/nuts/nut00/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -738,12 +738,22 @@ mod tests {
);

assert_eq!(proof.len(), 2);
}

let transaction_id = TransactionId::new(proof).unwrap();
#[test]
fn test_transaction_id() {
let proof = "[{\"id\":\"009a1f293253e41e\",\"amount\":2,\"secret\":\"407915bc212be61a77e3e6d2aeb4c727980bda51cd06a6afc29e2861768a7837\",\"C\":\"02bc9097997d81afb2cc7346b5e4345a9346bd2a506eb7958598a72f0cf85163ea\"},{\"id\":\"009a1f293253e41e\",\"amount\":8,\"secret\":\"fe15109314e61d7756b0f8ee0f23a624acaa3f4e042f61433c728c7057b931be\",\"C\":\"029e8e5050b890a7d6c0968db16bc1d5d5fa040ea1de284f6ec69d61299f671059\"}]";
let mut proofs: Proofs = serde_json::from_str(proof).unwrap();

let transaction_id = TransactionId::new(proofs.clone()).unwrap();
assert_eq!(
transaction_id.to_string(),
"dac0748828d855ac4bc0e0a008cbc4b02e7d4238af06d730461cc559a5ae24b1"
);

proofs.reverse();
let rev_transaction_id = TransactionId::new(proofs).unwrap();
assert_eq!(transaction_id, rev_transaction_id);
}

#[test]
Expand Down

0 comments on commit bd4fdd0

Please sign in to comment.