-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Have promise rejection tests mirror how Chai tests exceptions. #167
Have promise rejection tests mirror how Chai tests exceptions. #167
Commits on Sep 15, 2016
-
Added test cases to cover issue chaijs#47.
The problem is that expect().to.be.rejected/rejectedWith (and its negation) does not mirror how expect().to.throw (and its negation) behave. Same issue with assert.isRejected in relation to assert.throws.
Configuration menu - View commit details
-
Copy full SHA for 56ea133 - Browse repository at this point
Copy the full SHA 56ea133View commit details -
Configuration menu - View commit details
-
Copy full SHA for f06f849 - Browse repository at this point
Copy the full SHA f06f849View commit details -
Configuration menu - View commit details
-
Copy full SHA for 17d7dd8 - Browse repository at this point
Copy the full SHA 17d7dd8View commit details -
Configuration menu - View commit details
-
Copy full SHA for cd4f4b9 - Browse repository at this point
Copy the full SHA cd4f4b9View commit details -
The problem with issue chaijs#47 is that chai-as-promised somtimes treats the final string parameter as a custom error message. We want to test that it does not do this anymore so we check to make sure that such string is not used as a custom error message.
Configuration menu - View commit details
-
Copy full SHA for 828c2d2 - Browse repository at this point
Copy the full SHA 828c2d2View commit details -
Allow chaining tests and promises.
- `.fulfilled`, `.not.rejected` and `.not.rejectedWith` when successful: * The promise they return is fulfilled with the same value as the promise they were testing. - When `.not.fulfilled`, `.rejected` and `.rejectedWith` are successful: * The promise they return is fulfilled with the rejection reason. In all cases, when they fail, the promise they return is rejected and has for reason the assertion that failed. The changes above make it so that the `object` flag is automatically set when the promise returned is resolved, and thus also allows chaining. This fixes chaijs#113.
Configuration menu - View commit details
-
Copy full SHA for 1e629d3 - Browse repository at this point
Copy the full SHA 1e629d3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 79f12ac - Browse repository at this point
Copy the full SHA 79f12acView commit details -
Use check-error to get expected constructor name.
We now use the check-error package to get the constructor name of the error we expect to get with `rejectedWith`. For recent versions of Chai, this makes `rejectedWith` consistent in behavior with Chai's `throw`. Fixes chaijs#64.
Configuration menu - View commit details
-
Copy full SHA for 4656d67 - Browse repository at this point
Copy the full SHA 4656d67View commit details -
Fix the .not.rejectedWith tests.
In Chai `foo.should.not.throw(Constructor, 'string')` would fail only if the error thrown is an instance of `Constructor` **and** if its message includes `'string'`. An instance with a different message would not cause a failure. An instance constructed by something else than `Constructor` would not cause a failure. .not.rejectedWith's semantics were incompatible with the above. This commit fixes the test to work according to the correct semantics.
Configuration menu - View commit details
-
Copy full SHA for 150b666 - Browse repository at this point
Copy the full SHA 150b666View commit details -
Configuration menu - View commit details
-
Copy full SHA for ddc7bf7 - Browse repository at this point
Copy the full SHA ddc7bf7View commit details
Commits on Sep 18, 2016
-
Bring promise rejection tests in line with Chai.
chai-as-promised's `.rejectedWith` and `assert.isRejected` now mirror how Chai's `.throws` works. Fixes issue chaijs#47.
Configuration menu - View commit details
-
Copy full SHA for c6188f4 - Browse repository at this point
Copy the full SHA c6188f4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8f1fa2b - Browse repository at this point
Copy the full SHA 8f1fa2bView commit details