1
0
Fork 0
spacetac/src/core/effects/AttributeEffect.spec.ts

25 lines
933 B
TypeScript
Raw Normal View History

2017-09-24 22:23:22 +00:00
module TK.SpaceTac {
describe("AttributeEffect", function () {
it("is not applied directly", function () {
let ship = new Ship();
2017-06-11 20:44:12 +00:00
expect(ship.getAttribute("maneuvrability")).toBe(0);
2017-06-11 20:44:12 +00:00
let effect = new AttributeEffect("maneuvrability", 20);
effect.applyOnShip(ship, ship);
2017-06-11 20:44:12 +00:00
expect(ship.getAttribute("maneuvrability")).toBe(0);
ship.sticky_effects.push(new StickyEffect(effect, 2));
ship.updateAttributes();
2017-06-11 20:44:12 +00:00
expect(ship.getAttribute("maneuvrability")).toBe(20);
});
it("has a description", function () {
2017-06-11 20:44:12 +00:00
let effect = new AttributeEffect("maneuvrability", 12);
expect(effect.getDescription()).toEqual("maneuvrability +12");
effect = new AttributeEffect("shield_capacity", -4);
expect(effect.getDescription()).toEqual("shield capacity -4");
});
});
}