Write more tests for capacity.
This commit is contained in:
parent
4652fa52cf
commit
51b4c5847f
@ -56,4 +56,30 @@ mod test {
|
||||
assert_eq!(check_item_capacity(&mock_db, "player/foo", 10).await.unwrap(),
|
||||
CapacityLevel::AboveItemLimit);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn check_item_capacity_should_say_overburdened_if_over() {
|
||||
let mut mock_db = MockDBTrans::new();
|
||||
mock_db.expect_get_location_stats()
|
||||
.withf(|s| s == "player/foo")
|
||||
.returning(|_| Ok(LocationStats {
|
||||
total_count: 2,
|
||||
total_weight: 100,
|
||||
}));
|
||||
assert_eq!(check_item_capacity(&mock_db, "player/foo", 1000000).await.unwrap(),
|
||||
CapacityLevel::OverBurdened);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn check_item_capacity_should_say_unburdened_when_low_weight() {
|
||||
let mut mock_db = MockDBTrans::new();
|
||||
mock_db.expect_get_location_stats()
|
||||
.withf(|s| s == "player/foo")
|
||||
.returning(|_| Ok(LocationStats {
|
||||
total_count: 2,
|
||||
total_weight: 100,
|
||||
}));
|
||||
assert_eq!(check_item_capacity(&mock_db, "player/foo", 50).await.unwrap(),
|
||||
CapacityLevel::Unburdened);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user