Skip to content

Instantly share code, notes, and snippets.

@randymorris
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save randymorris/439a85bccc856ca4e8c1 to your computer and use it in GitHub Desktop.
Save randymorris/439a85bccc856ca4e8c1 to your computer and use it in GitHub Desktop.
describe('Example', function () {
it('should fail when extra undefined keys are passed', function() {
var test = jest.genMockFunction();
test({a: 1, b: undefined});
expect(test).toBeCalledWith({a: 1});
});
});
$ jest
Using Jest CLI v0.2.1
PASS __tests__/example-test.js (0.018s)
1 test passed (1 total)
Run time: 0.417s
$ jest
Using Jest CLI v0.2.1
FAIL __tests__/example-test.js (0.03s)
● Example › it should fail when extra undefined keys are passed
- Expected: {
| 0: {
| | a: 1,
| | b: undefined
| }
} toEqual: {
| 0: {
| | a: 1
| }
}
at addMatchers.toBeCalledWith (/usr/lib/node_modules/jest-cli/src/jasmineTestRunner/jasmineTestRunner.js:217:18)
at Spec.<anonymous> (/home/user/tmp/test/__tests__/example-test.js:5:18)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
1 test failed, 0 tests passed (1 total)
Run time: 0.424s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment