2017-11-14 00:07:06 +00:00
|
|
|
module TK.SpaceTac.Specs {
|
2018-01-02 18:23:12 +00:00
|
|
|
testing("EndBattleDiff", test => {
|
2017-11-14 00:07:06 +00:00
|
|
|
test.case("applies and reverts", check => {
|
|
|
|
let battle = new Battle();
|
|
|
|
|
2018-01-02 18:23:12 +00:00
|
|
|
let ship1 = battle.fleets[0].addShip();
|
|
|
|
let ship2 = battle.fleets[1].addShip();
|
|
|
|
|
|
|
|
battle.start();
|
|
|
|
|
2017-11-14 00:07:06 +00:00
|
|
|
TestTools.diffChain(check, battle, [
|
|
|
|
new EndBattleDiff(battle.fleets[1], 4)
|
|
|
|
], [
|
|
|
|
check => {
|
|
|
|
check.equals(battle.ended, false, "battle is ongoing");
|
|
|
|
check.equals(battle.outcome, null, "battle has no outcome");
|
|
|
|
},
|
|
|
|
check => {
|
|
|
|
check.equals(battle.ended, true, "battle is ended");
|
2018-06-13 21:52:36 +00:00
|
|
|
check.same(nn(battle.outcome).winner, battle.fleets[1].id, "battle has an outcome");
|
2017-11-14 00:07:06 +00:00
|
|
|
},
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|