Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion starter-code/src/viking.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// Soldier
function Soldier() {}
function Soldier( health, strength){
this.health= health;
this.strength= strength;
}
Soldier.prototype.attack= function(){
return this.strength;
}

// Viking
function Viking() {}
Expand All @@ -9,3 +15,8 @@ function Saxon() {}

// War
function War() {}


Vehicle.prototype.start = function () {
this.running = true;
};
36 changes: 18 additions & 18 deletions starter-code/tests/VikingSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ 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 () {
// 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 () {
Expand Down