1
0
Fork 0
spacetac/src/ui/map/StarSystemDisplay.spec.ts

33 lines
1.2 KiB
TypeScript
Raw Normal View History

2017-09-24 22:23:22 +00:00
module TK.SpaceTac.UI.Specs {
2017-10-26 21:47:13 +00:00
testing("StarSystemDisplay", test => {
2017-10-29 21:08:55 +00:00
let testgame = setupMapview(test);
2017-09-12 22:37:56 +00:00
2017-10-26 21:47:13 +00:00
test.case("displays a badge with the current state for a star location", check => {
2017-10-09 21:13:56 +00:00
let mapview = testgame.view;
let location = mapview.player_fleet.location;
2017-09-12 22:37:56 +00:00
let ssdisplay = nn(first(mapview.starsystems, ss => ss.starsystem == location.star));
2017-10-09 21:13:56 +00:00
let ldisplay = nn(first(ssdisplay.locations, loc => loc[0] != location));
2017-10-26 21:47:13 +00:00
check.equals(ldisplay[2].name, "map-status-unvisited");
2017-09-12 22:37:56 +00:00
2017-10-09 21:13:56 +00:00
ldisplay[0].setupEncounter();
2017-09-12 22:37:56 +00:00
ssdisplay.updateInfo(2, true);
2017-10-26 21:47:13 +00:00
check.equals(ldisplay[2].name, "map-status-unvisited");
2017-09-12 22:37:56 +00:00
mapview.player.fleet.visited.push(ldisplay[0].id);
2017-09-12 22:37:56 +00:00
ssdisplay.updateInfo(2, true);
2017-10-26 21:47:13 +00:00
check.equals(ldisplay[2].name, "map-status-enemy");
2017-09-12 22:37:56 +00:00
2017-10-09 21:13:56 +00:00
ldisplay[0].shop = null;
ldisplay[0].clearEncounter();
2017-09-12 22:37:56 +00:00
ssdisplay.updateInfo(2, true);
2017-10-26 21:47:13 +00:00
check.equals(ldisplay[2].name, "map-status-clear");
2017-10-09 21:13:56 +00:00
ldisplay[0].shop = new Shop();
ssdisplay.updateInfo(2, true);
2017-10-26 21:47:13 +00:00
check.equals(ldisplay[2].name, "map-status-dockyard");
2017-09-12 22:37:56 +00:00
});
});
}