Skip to content

Instantly share code, notes, and snippets.

@pdtaylor
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pdtaylor/8a7e05811e85e2cee9e0 to your computer and use it in GitHub Desktop.
Save pdtaylor/8a7e05811e85e2cee9e0 to your computer and use it in GitHub Desktop.
Example 3 Test
describe("The getAnimal function", function(){
beforeEach(function(){
window.myLib.initialize();
});
it("should set Animal name property to Cat"){
window.myLib.selector.getAnimal("c")
expect(window.myLib.selector.name).toBe("Cat");
};
it("should set Animal name property to Dog"){
window.myLib.selector.getAnimal("d")
expect(window.myLib.selector.name).toBe("Dog");
}
it("should set Animal name property to unknown"){
window.myLib.selector.getAnimal()
expect(window.myLib.selector.name).toBe("unknown");
}
});
describe("The selectAnimal function", function(){
it("should call the getAnimal function"){
window.myLib.initialize();
spyOn(window.myLib.selector, "getAnimal");
window.myLib.selectAnimal();
expect(window.myLib.selector.getAnimal).toHaveBeenCalled();
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment