Skip to content

Commit 9ea0a9c

Browse files
committed
fix: use actual and expected
1 parent 28ba81f commit 9ea0a9c

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

crates/services/gas_price_service/src/v1/da_source_adapter/block_committer_costs.rs

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -219,22 +219,19 @@ mod tests {
219219
) {
220220
// given
221221
let da_block_costs = test_da_block_costs();
222+
let expected = DaBlockCosts {
223+
l2_block_range: da_block_costs.blocks_range.clone(),
224+
blob_size_bytes: da_block_costs.total_size_bytes,
225+
blob_cost_wei: da_block_costs.total_cost,
226+
};
222227
let mock_api = MockBlockCommitterApi::new(Some(da_block_costs.clone()));
223228
let mut block_committer = BlockCommitterDaBlockCosts::new(mock_api, None);
224229

225230
// when
226-
let block_committer_da_block_costs =
227-
block_committer.request_da_block_cost().await.unwrap();
231+
let actual = block_committer.request_da_block_cost().await.unwrap();
228232

229233
// then
230-
assert_eq!(
231-
block_committer_da_block_costs,
232-
DaBlockCosts {
233-
l2_block_range: da_block_costs.blocks_range.clone(),
234-
blob_size_bytes: da_block_costs.total_size_bytes,
235-
blob_cost_wei: da_block_costs.total_cost,
236-
}
237-
);
234+
assert_eq!(actual, expected);
238235
assert!(block_committer.last_value.is_some());
239236
}
240237

@@ -248,10 +245,10 @@ mod tests {
248245
BlockCommitterDaBlockCosts::new(mock_api, Some(da_block_costs.clone()));
249246

250247
// when
251-
let updated = block_committer.request_da_block_cost().await.unwrap();
248+
let actual = block_committer.request_da_block_cost().await.unwrap();
252249

253250
// then
254-
assert_ne!(da_block_costs.blocks_range, updated.l2_block_range);
251+
assert_ne!(da_block_costs.blocks_range, actual.l2_block_range);
255252
}
256253

257254
#[tokio::test]
@@ -310,23 +307,21 @@ mod tests {
310307
async fn request_da_block_cost__when_underflow__then_error() {
311308
// given
312309
let da_block_costs = test_da_block_costs();
310+
let expected = DaBlockCosts {
311+
l2_block_range: da_block_costs.blocks_range.clone(),
312+
blob_size_bytes: da_block_costs.total_size_bytes,
313+
blob_cost_wei: da_block_costs.total_cost,
314+
};
313315
let mock_api =
314316
UnderflowingMockBlockCommitterApi::new(Some(da_block_costs.clone()));
315317
let mut block_committer = BlockCommitterDaBlockCosts::new(mock_api, None);
316318

317319
// when
318-
let initial = block_committer.request_da_block_cost().await.unwrap();
320+
let actual = block_committer.request_da_block_cost().await.unwrap();
319321
let result = block_committer.request_da_block_cost().await;
320322

321323
// then
322324
assert!(result.is_err());
323-
assert_eq!(
324-
initial,
325-
DaBlockCosts {
326-
l2_block_range: da_block_costs.blocks_range.clone(),
327-
blob_size_bytes: da_block_costs.total_size_bytes,
328-
blob_cost_wei: da_block_costs.total_cost,
329-
}
330-
);
325+
assert_eq!(actual, expected);
331326
}
332327
}

0 commit comments

Comments
 (0)