Skip to content

Commit

Permalink
fix: integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
veeso committed Mar 12, 2024
1 parent 2774d4d commit 4709ce2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
4 changes: 3 additions & 1 deletion integration-tests/tests/inspect/deferred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,13 +521,15 @@ fn test_should_inspect_sign_contract() {

let contract_id = client.register_contract(agent, registration_data).unwrap();

let result: anyhow::Result<DeferredResult<ID>> = env.update(
let result: anyhow::Result<DeferredResult<()>> = env.update(
env.deferred_id,
agent,
"sign_contract",
Encode!(&contract_id).unwrap(),
);

println!("{:?}", result);

assert!(result.is_ok());
}

Expand Down
29 changes: 25 additions & 4 deletions integration-tests/tests/use_case/increment_contract_value.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use did::deferred::{ContractRegistration, ContractType, GenericValue, Seller};
use integration_tests::actor::{admin, alice};
use did::deferred::{Agency, ContractRegistration, ContractType, GenericValue, Seller};
use integration_tests::actor::{alice, bob};
use integration_tests::client::DeferredClient;
use integration_tests::TestEnv;
use pretty_assertions::assert_eq;
Expand All @@ -10,6 +10,27 @@ fn test_as_seller_i_can_set_the_contract_buyers() {
let env = TestEnv::init();
let deferred_client = DeferredClient::from(&env);

let agent = bob();
// give bob an agency
deferred_client.admin_register_agency(
agent,
Agency {
name: "Bob's agency".to_string(),
address: "Via Delle Botteghe Scure".to_string(),
city: "Rome".to_string(),
region: "Lazio".to_string(),
zip_code: "00100".to_string(),
country: "Italy".to_string(),
continent: did::deferred::Continent::Europe,
email: "email".to_string(),
website: "website".to_string(),
mobile: "mobile".to_string(),
vat: "vat".to_string(),
agent: "agent".to_string(),
logo: None,
},
);

let registration_data = ContractRegistration {
r#type: ContractType::Sell,
sellers: vec![Seller {
Expand All @@ -29,7 +50,7 @@ fn test_as_seller_i_can_set_the_contract_buyers() {

// call register
let contract_id = deferred_client
.register_contract(admin(), registration_data)
.register_contract(agent, registration_data)
.unwrap();

// sign contract
Expand All @@ -38,7 +59,7 @@ fn test_as_seller_i_can_set_the_contract_buyers() {

// increment contract value
assert!(deferred_client
.increment_contract_value(alice(), contract_id, 100_000, 1_000)
.increment_contract_value(agent, contract_id, 100_000, 1_000)
.is_ok());

// verify new value and supply
Expand Down

0 comments on commit 4709ce2

Please sign in to comment.