Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
update rust
Browse files Browse the repository at this point in the history
  • Loading branch information
nitro-neal committed Oct 1, 2024
1 parent fb8da28 commit 330550d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
23 changes: 23 additions & 0 deletions crates/tbdex/src/messages/order_instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,26 @@ pub struct PaymentInstruction {
#[serde(skip_serializing_if = "Option::is_none")]
pub instruction: Option<String>,
}
#[cfg(test)]
mod tbdex_test_vectors_protocol {
use super::*;
use std::fs;

#[derive(Debug, serde::Deserialize)]
pub struct OrderInstructionsTestVector {
pub input: String,
pub output: OrderInstructions,
}

#[test]
fn parse_order_instructions() {
print!("~~RUNNING");
let path = "../../tbdex/hosted/test-vectors/protocol/vectors/parse-orderinstructions.json";
let test_vector_json: String = fs::read_to_string(path).unwrap();

let test_vector: OrderInstructionsTestVector = serde_json::from_str(&test_vector_json).unwrap();
let parsed_order_instructions: OrderInstructions = OrderInstructions::from_json_string(&test_vector.input).unwrap();

assert_eq!(test_vector.output, parsed_order_instructions);
}
}
1 change: 0 additions & 1 deletion crates/tbdex/src/messages/quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ pub struct QuoteDetails {
pub fee: Option<String>,
}

// TODO: Uncomment when we have parse_quote.json vector updated with no payment instructions
#[cfg(test)]
mod tbdex_test_vectors_protocol {
use super::*;
Expand Down

0 comments on commit 330550d

Please sign in to comment.