Skip to content

Instantly share code, notes, and snippets.

@joechan3
Created July 8, 2016 20:44
Show Gist options
  • Save joechan3/c15159cef031b72e82bea652be2f4ef3 to your computer and use it in GitHub Desktop.
Save joechan3/c15159cef031b72e82bea652be2f4ef3 to your computer and use it in GitHub Desktop.
Jasmine Spec Boilerplate
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