File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,6 @@ impl MrhWatcher {
62
62
let update = SwapStatus {
63
63
id : routing_hint. swapId . clone ( ) ,
64
64
status : SwapUpdateStatus :: TransactionDirect . to_string ( ) ,
65
- zero_conf_rejected : None ,
66
65
transaction : Some ( TransactionInfo {
67
66
id : tx. txid_hex ( ) ,
68
67
hex : Some ( tx. serialize ( ) . to_lower_hex_string ( ) ) ,
@@ -111,7 +110,6 @@ mod test {
111
110
112
111
#[ tokio:: test]
113
112
async fn test_listen ( ) {
114
- // Create broadcast channels
115
113
let ( swap_status_update_tx, mut swap_status_update_rx) = broadcast:: channel ( 256 ) ;
116
114
let ( tx_sender, tx_receiver) = broadcast:: channel ( 256 ) ;
117
115
@@ -145,7 +143,10 @@ mod test {
145
143
let received_update = swap_status_update_rx. recv ( ) . await . unwrap ( ) ;
146
144
147
145
assert_eq ! ( received_update. id, "123" ) ;
148
- assert_eq ! ( received_update. status, "transaction.direct" ) ;
146
+ assert_eq ! (
147
+ received_update. status,
148
+ SwapUpdateStatus :: TransactionDirect . to_string( )
149
+ ) ;
149
150
assert ! ( received_update. transaction. is_some( ) ) ;
150
151
151
152
let transaction_info = received_update. transaction . unwrap ( ) ;
Original file line number Diff line number Diff line change @@ -74,6 +74,30 @@ describe('Sidecar', () => {
74
74
) ;
75
75
} ) ;
76
76
77
+ test ( `should handle status ${ SwapUpdateEvent . TransactionDirect } ` , async ( ) => {
78
+ const update = new sidecarrpc . SwapUpdate ( ) ;
79
+ update . setId ( 'test-swap' ) ;
80
+ update . setStatus ( SwapUpdateEvent . TransactionDirect ) ;
81
+ const transactionInfo = new sidecarrpc . SwapUpdate . TransactionInfo ( ) ;
82
+ transactionInfo . setId ( 'txid' ) ;
83
+ transactionInfo . setHex ( 'hex' ) ;
84
+ update . setTransactionInfo ( transactionInfo as any ) ;
85
+
86
+ await sidecar [ 'handleSentSwapUpdate' ] ( update ) ;
87
+
88
+ expect ( eventHandler . nursery . emit ) . toHaveBeenCalledTimes ( 1 ) ;
89
+ expect ( eventHandler . nursery . emit ) . toHaveBeenCalledWith ( 'swap.update' , {
90
+ id : update . getId ( ) ,
91
+ status : {
92
+ status : SwapUpdateEvent . TransactionDirect ,
93
+ transaction : {
94
+ id : transactionInfo . getId ( ) ,
95
+ hex : transactionInfo . getHex ( ) ,
96
+ } ,
97
+ } ,
98
+ } ) ;
99
+ } ) ;
100
+
77
101
test . each `
78
102
status
79
103
${ SwapUpdateEvent . InvoicePaid }
You can’t perform that action at this time.
0 commit comments