Last active
January 24, 2016 05:05
-
-
Save MilanGrubnic70/742f08c9d49280b78265 to your computer and use it in GitHub Desktop.
Jasmine Cheat Sheet
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
Matchers Reference | |
toEqual checks for equality, not necessarily the same object. | |
toBe checks if two objects are the same. | |
toBeTruthy checks if a value is truthy (not just true). | |
toBeFalsy checks if a value is falsy (not just false). | |
toContain checks if a value is inside another. | |
toBeDefined checks if a value is defined. | |
toBeUndefined checks if a value is undefined. | |
toBeNull checks if a value is null. | |
toBeNaN checks if a value is NaN. | |
toBeCloseTo checks decimal proximity. | |
toMatch checks if a value matches a given regular expression. | |
toThrow checks if a function throws an error. | |
.not inverts the meaning of the following matcher. | |
List of Falsy Values | |
false | |
0 | |
"" | |
undefined (note that the variable undefined isn’t always undefined!) | |
null | |
NaN | |
Reserved Words in Jasmine | |
The following are words that you shouldn’t use in your code so that you don’t cause conflicts with Jasmine: | |
jasmine (and everything in its namespace) | |
describe | |
it | |
expect | |
beforeEach | |
afterEach | |
runs | |
waits | |
waitsFor | |
spyOn | |
xdescribe | |
xit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment