1
0
Fork 0
spacetac/src/core/Slot.spec.ts

43 lines
1.3 KiB
TypeScript
Raw Normal View History

2017-09-24 22:23:22 +00:00
module TK.SpaceTac.Specs {
2017-10-26 21:47:13 +00:00
testing("Slot", test => {
test.case("checks equipment type", check => {
check.patch(console, "warn", null);
var ship = new Ship();
var slot = ship.addSlot(SlotType.Engine);
var equipment = new Equipment();
equipment.slot_type = SlotType.Weapon;
2017-10-26 21:47:13 +00:00
check.equals(slot.attached, null);
slot.attach(equipment);
2017-10-26 21:47:13 +00:00
check.equals(slot.attached, null);
equipment.slot_type = SlotType.Engine;
slot.attach(equipment);
2017-10-26 21:47:13 +00:00
check.same(slot.attached, equipment);
});
2017-10-26 21:47:13 +00:00
test.case("checks equipment capabilities", check => {
check.patch(console, "warn", null);
var ship = new Ship();
var slot = ship.addSlot(SlotType.Shield);
var equipment = new Equipment();
equipment.slot_type = SlotType.Shield;
equipment.requirements["skill_gravity"] = 5;
2017-10-26 21:47:13 +00:00
check.equals(slot.attached, null);
slot.attach(equipment);
2017-10-26 21:47:13 +00:00
check.equals(slot.attached, null);
TestTools.setAttribute(ship, "skill_gravity", 6);
slot.attach(equipment);
2017-10-26 21:47:13 +00:00
check.same(slot.attached, equipment);
});
});
}