Last active
August 29, 2015 14:14
-
-
Save pdtaylor/8a7e05811e85e2cee9e0 to your computer and use it in GitHub Desktop.
Example 3 Test
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("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