Skip to content

Instantly share code, notes, and snippets.

@microbial
Last active December 28, 2015 05:59
Show Gist options
  • Save microbial/7453942 to your computer and use it in GitHub Desktop.
Save microbial/7453942 to your computer and use it in GitHub Desktop.
Play Setup Requirements
describe("Play functionality to be tested", function (){
it("should start with a round", function () {
expect(Round).toBeDefined();
});
describe("Play intialization for a new round", function () {
var myRound = new Round();
it("should start with hole 1 if hole is unspecified", function () {
expect(myRound.startAtHole).toBe(1);
});
it("should start with a specified hole", function () {
var anotherRound = new Round(10).hole(10);
expect(anotherRound.startAtHole).toBe(10);
});
it("should start with shot 1 if current shot is unspecified", function () {
expect(myRound.startWithShot).toBe(1);
});
it("should start with a specified hole if provided", function () {
var anotherRound = new Round().shot(5);
expect(anotherRound.startWithShot).toBe(5);
});
it("should start with with driver as the default club", function () {
var myRound = new Round();
expect(myRound.startUsingClub).toBe("driver");
});
it("should have a hole par between 3 and 6", function () {
var myRound = new Round().par("4");
expect(myRound.startAtHolePar).toBe("4");
var myRound = new Round().par("7");
expect(myRound.startAtHolePar).toBe("Course Error: Hole par not set");
});
it("should start with 9-iron as default club on par 3 holes", function () {
var myRound = new Round().hole(3).par(3).club();
expect(myRound.startUsingClub).toBe("9-iron");
});
})
})
@microbial
Copy link
Author

Code review: Should have used a different variable other than myRound since I did in fact want a different instance of round when 'var myRound' was used explicitly. Poor naming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment