Adds another test for after you
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2023-01-06 14:40:55 +01:00
parent ebc1565429
commit b9351d057e
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 33 additions and 1 deletions

View File

@ -44,7 +44,7 @@ mod tests {
use super::*;
use alloc::rc::Rc;
use pkmn_lib_interface::app_interface::{
MockBattle, MockChoiceQueue, MockExecutingMove, MockPokemon,
MockBattle, MockChoiceQueue, MockExecutingMove, MockHitData, MockPokemon,
};
#[test]
@ -70,4 +70,36 @@ mod tests {
let script = AfterYou::new();
script.on_secondary_effect(Rc::new(MockExecutingMove::new()), target, 0);
}
#[test]
fn fails_when_move_pokemon_choice_next_can_not_move() {
let mut battle = MockBattle::new();
battle.expect_choice_queue().once().return_once_st(move || {
let mut choice_queue = MockChoiceQueue::new();
choice_queue
.expect_move_pokemon_choice_next()
.once()
.return_const(false);
Rc::new(choice_queue)
});
let battle = Rc::new(battle);
let mut target = MockPokemon::new();
target
.expect_battle()
.once()
.return_once_st(move || Some(battle));
let target = Rc::new(target);
let mut mv = MockExecutingMove::new();
mv.expect_get_hit_data().once().returning_st(move |_, _| {
let mut hit = MockHitData::new();
hit.expect_fail().once();
Rc::new(hit)
});
let mv = Rc::new(mv);
let script = AfterYou::new();
script.on_secondary_effect(mv, target, 0);
}
}