From 61cb819b7fee7f0f9d92e1ea452c8e99f0e18780 Mon Sep 17 00:00:00 2001 From: Gloria Visus Date: Sun, 30 Jun 2019 13:24:08 +0200 Subject: [PATCH 1/2] ejercicio empezado --- starter-code/src/viking.js | 7 +++++-- starter-code/tests/VikingSpec.js | 18 +++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/starter-code/src/viking.js b/starter-code/src/viking.js index 46a229138..3a0e13fdf 100755 --- a/starter-code/src/viking.js +++ b/starter-code/src/viking.js @@ -1,6 +1,9 @@ // Soldier -function Soldier() {} - + function Soldier( health, strength){ + this.health= health; + this.strength= strength; + } + // Viking function Viking() {} diff --git a/starter-code/tests/VikingSpec.js b/starter-code/tests/VikingSpec.js index ebaea7cfa..f40c87a42 100755 --- a/starter-code/tests/VikingSpec.js +++ b/starter-code/tests/VikingSpec.js @@ -8,17 +8,17 @@ describe("Soldier", function () { }); describe("constructor function", function () { - // it("should receive 2 arguments (health & strength)", function () { - // expect(Soldier.length).toEqual(2); - // }); + it("should receive 2 arguments (health & strength)", function () { + expect(Soldier.length).toEqual(2); + }); - // it("should receive the health property as its 1st argument", function () { - // expect(soldier.health).toEqual(health); - // }); + it("should receive the health property as its 1st argument", function () { + expect(soldier.health).toEqual(health); + }); - // it("should receive the strength property as its 2nd argument", function () { - // expect(soldier.strength).toEqual(strength); - // }); + it("should receive the strength property as its 2nd argument", function () { + expect(soldier.strength).toEqual(strength); + }); }); describe("attack() method", function () { From 7af0dc558a39a00f039580483f6ff73f680d0dd4 Mon Sep 17 00:00:00 2001 From: Gloria Visus Date: Sun, 30 Jun 2019 13:53:19 +0200 Subject: [PATCH 2/2] ejercicio empezado --- starter-code/src/viking.js | 10 +++++++++- starter-code/tests/VikingSpec.js | 18 +++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/starter-code/src/viking.js b/starter-code/src/viking.js index 3a0e13fdf..d427b33ff 100755 --- a/starter-code/src/viking.js +++ b/starter-code/src/viking.js @@ -3,7 +3,10 @@ this.health= health; this.strength= strength; } - + Soldier.prototype.attack= function(){ + return this.strength; + } + // Viking function Viking() {} @@ -12,3 +15,8 @@ function Saxon() {} // War function War() {} + + +Vehicle.prototype.start = function () { + this.running = true; +}; \ No newline at end of file diff --git a/starter-code/tests/VikingSpec.js b/starter-code/tests/VikingSpec.js index f40c87a42..ff915933e 100755 --- a/starter-code/tests/VikingSpec.js +++ b/starter-code/tests/VikingSpec.js @@ -22,17 +22,17 @@ describe("Soldier", function () { }); describe("attack() method", function () { - // it("should be a function", function () { - // expect(typeof(soldier.attack)).toBe("function"); - // }); + it("should be a function", function () { + expect(typeof(soldier.attack)).toBe("function"); + }); - // it("should receive 0 arguments", function () { - // expect(soldier.attack.length).toEqual(0); - // }); + it("should receive 0 arguments", function () { + expect(soldier.attack.length).toEqual(0); + }); - // it("should return the strength property of the Soldier", function () { - // expect(soldier.attack()).toEqual(strength); - // }); + it("should return the strength property of the Soldier", function () { + expect(soldier.attack()).toEqual(strength); + }); }); describe("receiveDamage() method", function () {