Created
July 8, 2016 20:44
-
-
Save joechan3/c15159cef031b72e82bea652be2f4ef3 to your computer and use it in GitHub Desktop.
Jasmine Spec Boilerplate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("Calculator", function () { | |
beforeEach(function () { | |
Calculator.current = 0; | |
}); | |
describe("When adding numbers", function () { | |
it("should store the current value at all times", function () { | |
expect(Calculator.current).toBeDefined(); | |
}); | |
it("should add numbers", function () { | |
expect(Calculator.add(5)).toEqual(5); | |
expect(Calculator.add(5)).toEqual(10); | |
}); | |
it("should add any number of numbers", function () { | |
expect(Calculator.add(1, 2, 3)).toEqual(6); | |
expect(Calculator.add(1, 2, 3, 4)).toEqual(16); | |
}); | |
}); | |
describe("Some feature", function(){ | |
it("should return true when called", function(){ | |
expect(someFunction()).toBeTruthy(); | |
}); | |
it("returns an array of names", function(){ | |
expect(anotherFunction()).toContain("jeffrey"); | |
}); | |
}); | |
afterEach(function(){ | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment