Skip to content

Commit

Permalink
Fix tests failing
Browse files Browse the repository at this point in the history
  • Loading branch information
Sliman4 committed Dec 13, 2024
1 parent a8b143b commit 1ab8c16
Show file tree
Hide file tree
Showing 6 changed files with 208 additions and 127 deletions.
3 changes: 0 additions & 3 deletions crates/oracle-contract/src/producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,12 @@ impl OracleResponder for Oracle {
.get_mut(&producer_id)
.expect("Producer is not registered");
if let Some(pending_request) = producer.requests_pending.remove(&request_id) {
log!("1");
if !env::promise_yield_resume(
&pending_request.resumption_token,
&serde_json::to_vec(&response).expect("Can't serialize on_response args"),
) {
log!("2");
env::panic_str("Resumption token not found")
}
log!("3");
} else {
env::panic_str("Request not found or already responded to")
}
Expand Down
8 changes: 4 additions & 4 deletions crates/oracle-contract/tests/deposits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use serde_json::json;
#[tokio::test]
async fn near_deposits() -> Result<(), Box<dyn std::error::Error>> {
let sandbox = near_workspaces::sandbox().await?;
let contract_wasm = near_workspaces::compile_project("./").await?;
let contract_wasm = include_bytes!("../../../target/near/intear_oracle/intear_oracle.wasm");

let contract = sandbox.dev_deploy(&contract_wasm).await?;
let contract = sandbox.dev_deploy(contract_wasm).await?;

let consumer_account = sandbox.dev_create_account().await?;
let initial_balance = consumer_account.view_account().await?.balance;
Expand Down Expand Up @@ -138,9 +138,9 @@ async fn near_deposits() -> Result<(), Box<dyn std::error::Error>> {
#[tokio::test]
async fn near_deposit_for_producer() -> Result<(), Box<dyn std::error::Error>> {
let sandbox = near_workspaces::sandbox().await?;
let contract_wasm = near_workspaces::compile_project("./").await?;
let contract_wasm = include_bytes!("../../../target/near/intear_oracle/intear_oracle.wasm");

let contract = sandbox.dev_deploy(&contract_wasm).await?;
let contract = sandbox.dev_deploy(contract_wasm).await?;

let consumer_account = sandbox.dev_create_account().await?;
let producer_account = sandbox.dev_create_account().await?;
Expand Down
Loading

0 comments on commit 1ab8c16

Please sign in to comment.