-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved to error assertion tests to a separate file
- Loading branch information
1 parent
84cff2b
commit 94633fe
Showing
2 changed files
with
44 additions
and
44 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/*global expect*/ | ||
describe('to error assertion', function () { | ||
describe('with a function that throws', function () { | ||
describe('with the "not" flag', function () { | ||
it('should indicate that the function threw', function () { | ||
expect(function () { | ||
expect(function () { | ||
throw new Error('yikes'); | ||
}, 'not to error'); | ||
}, 'to throw', | ||
"expected function () { throw new Error('yikes'); } not to error\n" + | ||
" threw: Error('yikes')" | ||
); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('with a function that returns a promise that is rejected', function () { | ||
describe('with the "not" flag', function () { | ||
it('should indicate that the function returned a rejected promise', function () { | ||
return expect( | ||
expect(function () { | ||
return expect.promise(function (resolve, reject) { | ||
setTimeout(function () { | ||
reject(new Error('wat')); | ||
}, 1); | ||
}); | ||
}, 'not to error'), | ||
'to be rejected with', | ||
"expected\n" + | ||
"function () {\n" + | ||
" return expect.promise(function (resolve, reject) {\n" + | ||
" setTimeout(function () {\n" + | ||
" reject(new Error('wat'));\n" + | ||
" }, 1);\n" + | ||
" });\n" + | ||
"}\n" + | ||
"not to error\n" + | ||
" returned promise rejected with: Error('wat')" | ||
); | ||
}); | ||
}); | ||
}); | ||
}); |
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