Skip to content

Commit

Permalink
add minimal test for cc vote
Browse files Browse the repository at this point in the history
  • Loading branch information
twwu123 committed Oct 7, 2024
1 parent c56c0f0 commit 98db61e
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion packages/whisky/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod int_tests {
};
use whisky::{
builder::{ TxBuilder, TxBuilderParam, WData::{self, JSON}, WRedeemer},
core::utils::merge_vkey_witnesses_to_transaction, model::{Anchor, DRep, RefTxIn, VoteKind, Voter, VotingProcedure},
core::utils::merge_vkey_witnesses_to_transaction, model::{Anchor, Credential, DRep, RefTxIn, VoteKind, Voter, VotingProcedure},
};

#[test]
Expand Down Expand Up @@ -523,6 +523,7 @@ mod int_tests {
.unwrap();

println!("{}", unsigned_tx);
assert!(mesh.core.mesh_csl.tx_hex != *"");
}

#[test]
Expand Down Expand Up @@ -550,6 +551,7 @@ mod int_tests {
.unwrap();

println!("{}", unsigned_tx);
assert!(mesh.core.mesh_csl.tx_hex != *"");
}

#[test]
Expand Down Expand Up @@ -585,5 +587,42 @@ mod int_tests {
.unwrap();

println!("{}", unsigned_tx);
assert!(mesh.core.mesh_csl.tx_hex != *"");
}

#[test]
fn test_cc_vote() {
let mut mesh = TxBuilder::new(TxBuilderParam {
evaluator: None,
fetcher: None,
submitter: None,
params: None,
});

let unsigned_tx = mesh
.change_address("addr_test1qpsmz8q2xj43wg597pnpp0ffnlvr8fpfydff0wcsyzqyrxguk5v6wzdvfjyy8q5ysrh8wdxg9h0u4ncse4cxhd7qhqjqk8pse6")
.tx_in(
"2cb57168ee66b68bd04a0d595060b546edf30c04ae1031b883c9ac797967dd85",
3,
&[Asset::new_from_str("lovelace", "9891607895")],
"addr_test1vru4e2un2tq50q4rv6qzk7t8w34gjdtw3y2uzuqxzj0ldrqqactxh",
)
.vote(&Voter::ConstitutionalCommitteeHotCred(Credential::KeyHash("e3a4c41d67592a1b8d87c62e5c5d73f7e8db836171945412d13f40f8".to_string())), &RefTxIn {
tx_hash: "2cb57168ee66b68bd04a0d595060b546edf30c04ae1031b883c9ac797967dd85".to_string(),
tx_index: 2
}, &VotingProcedure {
vote_kind: VoteKind::Abstain,
anchor: Some(Anchor {
anchor_url: "https://raw.githubusercontent.com/HinsonSIDAN/cardano-drep/main/HinsonSIDAN.jsonld".to_string(),
anchor_data_hash: "2aef51273a566e529a2d5958d981d7f0b3c7224fc2853b6c4922e019657b5060".to_string()
})
})
.complete_sync(None)
.unwrap()
.complete_signing()
.unwrap();

println!("{}", unsigned_tx);
assert!(mesh.core.mesh_csl.tx_hex != *"");
}
}

0 comments on commit 98db61e

Please sign in to comment.