Skip to content

Instantly share code, notes, and snippets.

@apeckham
Created May 30, 2010 18:58
Show Gist options
  • Save apeckham/419230 to your computer and use it in GitHub Desktop.
Save apeckham/419230 to your computer and use it in GitHub Desktop.
jsunit assertions for jasmine
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