Skip to content

Commit

Permalink
fixes: contract tests...?
Browse files Browse the repository at this point in the history
  • Loading branch information
prestwich committed Mar 26, 2024
1 parent e4d5df1 commit 8d1fd19
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions crates/contract/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,10 @@ mod tests {
async fn event_filters() {
init_tracing();

#[cfg(feature = "pubsub")]
#[cfg(feature = "ws")]
let (provider, anvil) = spawn_anvil();

#[cfg(not(feature = "pubsub"))]
#[cfg(not(feature = "ws"))]
let (provider, _anvil) = spawn_anvil();

let contract = MyContract::deploy(&provider).await.unwrap();
Expand Down Expand Up @@ -254,11 +254,12 @@ mod tests {
assert_eq!(all[0].0, expected_event);
assert_eq!(all[0].1, stream_log);

#[cfg(feature = "pubsub")]
#[cfg(feature = "ws")]
{
let ws = alloy_rpc_client::WsConnect::new(anvil.ws_endpoint());
let client = RpcClient::connect_pubsub(ws).await.unwrap();
let provider = RootProvider::<Ethereum, _>::new(client);
let provider = alloy_provider::ProviderBuilder::default()
.on_ws(anvil.ws_endpoint())
.await
.unwrap();

let contract = MyContract::new(*contract.address(), provider);
let event = contract.MyEvent_filter();
Expand Down

0 comments on commit 8d1fd19

Please sign in to comment.