2017-02-09 00:00:35 +00:00
|
|
|
module TS.SpaceTac.Specs {
|
2015-04-21 22:17:00 +00:00
|
|
|
describe("StarLocation", () => {
|
|
|
|
it("removes generated encounters that lose", function () {
|
|
|
|
var location = new StarLocation(null, StarLocationType.PLANET, 0, 0);
|
|
|
|
var fleet = new Fleet();
|
|
|
|
var random = new RandomGenerator(0);
|
|
|
|
var battle = location.enterLocation(fleet, random);
|
|
|
|
|
|
|
|
expect(location.encounter).not.toBeNull();
|
|
|
|
expect(battle).not.toBeNull();
|
|
|
|
|
|
|
|
battle.endBattle(fleet);
|
|
|
|
|
|
|
|
expect(location.encounter).toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("leaves generated encounters that win", function () {
|
|
|
|
var location = new StarLocation(null, StarLocationType.PLANET, 0, 0);
|
|
|
|
var fleet = new Fleet();
|
|
|
|
var random = new RandomGenerator(0);
|
|
|
|
var battle = location.enterLocation(fleet, random);
|
|
|
|
|
|
|
|
expect(location.encounter).not.toBeNull();
|
|
|
|
expect(battle).not.toBeNull();
|
|
|
|
|
|
|
|
battle.endBattle(location.encounter);
|
|
|
|
|
|
|
|
expect(location.encounter).not.toBeNull();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|