Skip to content

Commit 0887d6b

Browse files
author
Ludo Galabru
committed
fix: test warns and errors
1 parent 49a37e9 commit 0887d6b

File tree

5 files changed

+39
-11
lines changed

5 files changed

+39
-11
lines changed

components/chainhook-sdk/src/indexer/tests/helpers/stacks_blocks.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub fn generate_test_stacks_block(
4141
(
4242
BlockIdentifier {
4343
index: block_height - 1,
44-
hash: to_hex(&parent_hash[..]),
44+
hash: hex::encode(&parent_hash[..]),
4545
},
4646
None,
4747
)
@@ -51,7 +51,7 @@ pub fn generate_test_stacks_block(
5151
BlockEvent::Block(StacksBlockData {
5252
block_identifier: BlockIdentifier {
5353
index: block_height,
54-
hash: to_hex(&hash[..]),
54+
hash: hex::encode(&hash[..]),
5555
},
5656
parent_block_identifier,
5757
timestamp: 0,

components/chainhook-sdk/src/indexer/tests/helpers/transactions.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ pub fn generate_test_tx_bitcoin_p2pkh_transfer(
9292
.into_script();
9393
let outputs = vec![TxOut {
9494
value: amount,
95-
script_pubkey: format!("0x{}", to_hex(script.as_bytes())),
95+
script_pubkey: format!("0x{}", hex::encode(script.as_bytes())),
9696
}];
9797

9898
BitcoinTransactionData {
9999
transaction_identifier: TransactionIdentifier {
100-
hash: format!("0x{}", to_hex(&hash[..])),
100+
hash: format!("0x{}", hex::encode(&hash[..])),
101101
},
102102
operations: vec![],
103103
metadata: BitcoinTransactionMetadata {

components/chainhook-sdk/src/observer/tests/mod.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ use chainhook_types::{
1818
StacksBlockUpdate, StacksChainEvent, StacksChainUpdatedWithBlocksData, StacksNetwork,
1919
};
2020
use hiro_system_kit;
21-
use std::collections::{BTreeMap, HashMap, HashSet};
21+
use std::collections::BTreeMap;
2222
use std::sync::mpsc::{channel, Sender};
23-
use std::sync::{Arc, RwLock};
2423

2524
use super::ObserverEvent;
2625

@@ -132,7 +131,7 @@ fn generate_and_register_new_stacks_chainhook(
132131
ChainhookSpecification::Stacks(chainhook.clone()),
133132
));
134133
assert!(match observer_events_rx.recv() {
135-
Ok(ObserverEvent::PredicateRegistered(registered_chainhook)) => {
134+
Ok(ObserverEvent::PredicateRegistered(_)) => {
136135
// assert_eq!(
137136
// ChainhookSpecification::Stacks(chainhook.clone()),
138137
// registered_chainhook
@@ -145,7 +144,7 @@ fn generate_and_register_new_stacks_chainhook(
145144
ChainhookSpecification::Stacks(chainhook.clone()),
146145
));
147146
assert!(match observer_events_rx.recv() {
148-
Ok(ObserverEvent::PredicateEnabled(registered_chainhook)) => {
147+
Ok(ObserverEvent::PredicateEnabled(_)) => {
149148
// assert_eq!(
150149
// ChainhookSpecification::Bitcoin(chainhook.clone()),
151150
// registered_chainhook
@@ -176,7 +175,7 @@ fn generate_and_register_new_bitcoin_chainhook(
176175
ChainhookSpecification::Bitcoin(chainhook.clone()),
177176
));
178177
assert!(match observer_events_rx.recv() {
179-
Ok(ObserverEvent::PredicateRegistered(registered_chainhook)) => {
178+
Ok(ObserverEvent::PredicateRegistered(_)) => {
180179
// assert_eq!(
181180
// ChainhookSpecification::Bitcoin(chainhook.clone()),
182181
// registered_chainhook
@@ -186,7 +185,7 @@ fn generate_and_register_new_bitcoin_chainhook(
186185
_ => false,
187186
});
188187
assert!(match observer_events_rx.recv() {
189-
Ok(ObserverEvent::PredicateEnabled(registered_chainhook)) => {
188+
Ok(ObserverEvent::PredicateEnabled(_)) => {
190189
// assert_eq!(
191190
// ChainhookSpecification::Bitcoin(chainhook.clone()),
192191
// registered_chainhook
@@ -471,7 +470,7 @@ fn test_stacks_chainhook_auto_deregister() {
471470
ChainhookSpecification::Stacks(chainhook.clone()),
472471
));
473472
assert!(match observer_events_rx.recv() {
474-
Ok(ObserverEvent::PredicateRegistered(registered_chainhook)) => {
473+
Ok(ObserverEvent::PredicateRegistered(_)) => {
475474
// assert_eq!(
476475
// ChainhookSpecification::Stacks(chainhook.clone()),
477476
// registered_chainhook

tests/zest-onboard-user.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"uuid": "1",
3+
"name": "Stacking.club Events",
4+
"chain": "stacks",
5+
"version": 1,
6+
"networks": {
7+
"testnet": {
8+
"start_block": 1,
9+
"end_block": 103672,
10+
"if_this": {
11+
"contains": "onboard-user",
12+
"contract_identifier": "ST3AXH4EBHD63FCFPTZ8GR29TNTVWDYPGY0KDY5E5.globals",
13+
"scope": "print_event"
14+
},
15+
"then_that": {
16+
"file_append": {
17+
"path": "zest-results.txt"
18+
}
19+
}
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)