Skip to content

Instantly share code, notes, and snippets.

@pdtaylor

pdtaylor/example3-test.js

Last active Aug 29, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.