Created
May 30, 2010 18:58
-
-
Save apeckham/419230 to your computer and use it in GitHub Desktop.
jsunit assertions for jasmine
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
function assertEquals(expected, actual) { | |
expect(expected).toEqual(actual); | |
} | |
function assertNotEquals(expected, actual) { | |
expect(expected).toNotEqual(actual); | |
} | |
function assertTrue(value) { | |
expect(value).toBeTruthy(); | |
} | |
function assertFalse(value) { | |
expect(value).toBeFalsy(); | |
} | |
function assertNotUndefined(value) { | |
expect(value).toBeDefined(); | |
} | |
function assertUndefined(value) { | |
expect(value).not.toBeDefined(); | |
} | |
function assertArrayEquals(expected, actual) { | |
assertEquals(expected, actual); | |
} | |
function assertObjectEquals(expected, actual) { | |
delete actual["_"]; | |
assertEquals(expected, actual); | |
} | |
function assertContains(needle, haystack) { | |
expect(haystack).toContain(needle); | |
} | |
function assertNotNull(value) { | |
expect(value).not.toBeNull(); | |
} | |
function assertNull(value) { | |
expect(value).toBeNull(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment