2017-11-14 00:07:06 +00:00
|
|
|
module TK.SpaceTac.Specs {
|
|
|
|
testing("ShipCooldownDiff", test => {
|
|
|
|
test.case("applies and reverts", check => {
|
|
|
|
let battle = TestTools.createBattle();
|
|
|
|
let ship = battle.play_order[0];
|
|
|
|
let weapon = TestTools.addWeapon(ship);
|
2018-02-08 15:16:03 +00:00
|
|
|
weapon.configureCooldown(1, 3);
|
|
|
|
let cooldown = ship.actions.getCooldown(weapon);
|
|
|
|
cooldown.use();
|
2017-11-14 00:07:06 +00:00
|
|
|
|
|
|
|
TestTools.diffChain(check, battle, [
|
|
|
|
new ShipCooldownDiff(ship, weapon, 1),
|
|
|
|
new ShipCooldownDiff(ship, weapon, 2),
|
|
|
|
], [
|
|
|
|
check => {
|
2018-02-08 15:16:03 +00:00
|
|
|
check.equals(cooldown.heat, 3, "heat");
|
|
|
|
check.equals(cooldown.uses, 1, "uses");
|
2017-11-14 00:07:06 +00:00
|
|
|
},
|
|
|
|
check => {
|
2018-02-08 15:16:03 +00:00
|
|
|
check.equals(cooldown.heat, 2, "heat");
|
|
|
|
check.equals(cooldown.uses, 1, "uses");
|
2017-11-14 00:07:06 +00:00
|
|
|
},
|
|
|
|
check => {
|
2018-02-08 15:16:03 +00:00
|
|
|
check.equals(cooldown.heat, 0, "heat");
|
|
|
|
check.equals(cooldown.uses, 0, "uses");
|
2017-11-14 00:07:06 +00:00
|
|
|
},
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|