@@ -136,10 +136,14 @@ mod tests {
136
136
}
137
137
}
138
138
139
- fn build_importer (
140
- parser_mock_config : & dyn Fn ( & mut MockTransactionParserImpl ) ,
141
- store_mock_config : & dyn Fn ( & mut MockTransactionStore ) ,
142
- ) -> CardanoTransactionsImporter {
139
+ fn build_importer < TParser , TStore > (
140
+ parser_mock_config : TParser ,
141
+ store_mock_config : TStore ,
142
+ ) -> CardanoTransactionsImporter
143
+ where
144
+ TParser : FnOnce ( & mut MockTransactionParserImpl ) ,
145
+ TStore : FnOnce ( & mut MockTransactionStore ) ,
146
+ {
143
147
let db_path = Path :: new ( "" ) ;
144
148
let mut parser = MockTransactionParserImpl :: new ( ) ;
145
149
parser_mock_config ( & mut parser) ;
@@ -168,14 +172,14 @@ mod tests {
168
172
let up_to_beacon = 12 ;
169
173
170
174
let importer = build_importer (
171
- & |parser_mock| {
175
+ |parser_mock| {
172
176
let parsed_transactions = transactions. clone ( ) ;
173
177
parser_mock
174
178
. expect_parse ( )
175
179
. withf ( move |_, from, until| from. is_none ( ) && until == & up_to_beacon)
176
180
. return_once ( move |_, _, _| Ok ( parsed_transactions) ) ;
177
181
} ,
178
- & |store_mock| {
182
+ |store_mock| {
179
183
let expected_stored_transactions = transactions. clone ( ) ;
180
184
store_mock
181
185
. expect_get_highest_beacon ( )
@@ -199,10 +203,10 @@ mod tests {
199
203
let up_to_beacon = 12 ;
200
204
201
205
let importer = build_importer (
202
- & |parser_mock| {
206
+ |parser_mock| {
203
207
parser_mock. expect_parse ( ) . never ( ) ;
204
208
} ,
205
- & |store_mock| {
209
+ |store_mock| {
206
210
store_mock
207
211
. expect_get_highest_beacon ( )
208
212
. returning ( || Ok ( Some ( 12 ) ) ) ;
@@ -227,14 +231,14 @@ mod tests {
227
231
let up_to_beacon = 14 ;
228
232
229
233
let importer = build_importer (
230
- & |parser_mock| {
234
+ |parser_mock| {
231
235
let parsed_transactions = transactions[ 2 ..=3 ] . to_vec ( ) ;
232
236
parser_mock
233
237
. expect_parse ( )
234
238
. withf ( move |_, from, until| from == & Some ( 13 ) && until == & up_to_beacon)
235
239
. return_once ( move |_, _, _| Ok ( parsed_transactions) ) ;
236
240
} ,
237
- & |store_mock| {
241
+ |store_mock| {
238
242
store_mock
239
243
. expect_get_highest_beacon ( )
240
244
. returning ( || Ok ( Some ( 12 ) ) ) ;
0 commit comments