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 () {
|
2017-03-09 17:11:00 +00:00
|
|
|
var location = new StarLocation(undefined, StarLocationType.PLANET, 0, 0);
|
2015-04-21 22:17:00 +00:00
|
|
|
var fleet = new Fleet();
|
2017-03-14 22:28:07 +00:00
|
|
|
location.encounter_random = new SkewedRandomGenerator([0]);
|
|
|
|
var battle = location.enterLocation(fleet);
|
2015-04-21 22:17:00 +00:00
|
|
|
|
|
|
|
expect(location.encounter).not.toBeNull();
|
|
|
|
expect(battle).not.toBeNull();
|
|
|
|
|
2017-03-09 17:11:00 +00:00
|
|
|
nn(battle).endBattle(fleet);
|
2015-04-21 22:17:00 +00:00
|
|
|
|
|
|
|
expect(location.encounter).toBeNull();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("leaves generated encounters that win", function () {
|
2017-03-09 17:11:00 +00:00
|
|
|
var location = new StarLocation(undefined, StarLocationType.PLANET, 0, 0);
|
2015-04-21 22:17:00 +00:00
|
|
|
var fleet = new Fleet();
|
2017-03-14 22:28:07 +00:00
|
|
|
location.encounter_random = new SkewedRandomGenerator([0]);
|
|
|
|
var battle = location.enterLocation(fleet);
|
2015-04-21 22:17:00 +00:00
|
|
|
|
|
|
|
expect(location.encounter).not.toBeNull();
|
|
|
|
expect(battle).not.toBeNull();
|
|
|
|
|
2017-03-09 17:11:00 +00:00
|
|
|
nn(battle).endBattle(location.encounter);
|
2015-04-21 22:17:00 +00:00
|
|
|
|
|
|
|
expect(location.encounter).not.toBeNull();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|