A set of jasmine matchers that allow for more explicit test writing and better error reporting.
JavaScript CSS
Switch branches/tags
Nothing to show
Pull request Compare This branch is 9 commits ahead, 76 commits behind uxebu:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
src
test
.gitignore
README.md
package.json

README.md

The Jasmine testing framework from Pivotal Labs comes with this default set of matchers:

expect(function(){fn();}).toThrow(e);
expect(x).toBe(y);
expect(x).toBeDefined();
expect(x).toBeFalsy();
expect(x).toBeGreaterThan(y);
expect(x).toBeLessThan(y);
expect(x).toBeNull();
expect(x).toBeTruthy();
expect(x).toBeUndefined();
expect(x).toContain(y);
expect(x).toEqual(y);
expect(x).toMatch(pattern);

jasmine-matchers adds:

expect(x).toBeArray();
expect(x).toBeInstanceOf(Constructor);
expect(x).toBeNan();
expect(x).toBeOfType(type);
expect(x).toHaveLength(length);
expect(x).toHaveLengthGreaterThan(length);
expect(x).toHaveLengthSmallerThan(length);
expect(x).toHaveProperties(...properties);
expect(x).toHaveMethods(...methods);
expect(x).toHaveOwnMethods(...methods);
expect(x).toHaveOwnProperties(...properties);
expect(x).toEachHave(attr, val);
expect(x).toBeCloneOf(source);
expect(x).toNotBeCloneOf(source);
expect(x).toHavePropertieValue(attr, val);
expect(x).toIncludeObject(object);
expect(x).toMatchObject(object);
expect(x).toNotMatchObject(object); //not.toMatchObject(object);
expect(x).toNotMatch(object);
expect(x).toMatchLengthOf(object);
expect(x).toThrowInstanceOf(ExceptionType);
expect(x).toHaveBeenCalledXTimes(count);
expect(x).toContainOnce(value);
expect(x).toEndWith(value);
expect(x).toEachEndWith(value);
expect(x).toSomeEndWith(value);