Merge pull request #15657 from mhr3/should-with-promise-assertions

Added support for Promise assertions to "should"
This commit is contained in:
Ryan Cavanaugh
2017-04-17 13:14:52 -07:00
committed by GitHub
2 changed files with 12 additions and 8 deletions
+1 -7
View File
@@ -4,11 +4,5 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface ShouldAssertion {
Promise: ShouldAssertion;
fulfilled(): ShouldAssertion;
rejected(): ShouldAssertion;
rejectedWith(message: (string | Function | RegExp), properties?: Object): ShouldAssertion;
rejectedWith(message: Object): ShouldAssertion;
finally: ShouldAssertion;
eventually: ShouldAssertion;
// all of the extensions are now part of should itself
}
+11 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for should.js v8.1.1
// Type definitions for should.js v8.3.0
// Project: https://github.com/shouldjs/should.js
// Definitions by: Alex Varju <https://github.com/varju/>, Maxime LUCE <https://github.com/SomaticIT/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -42,6 +42,7 @@ interface ShouldAssertion {
Class(): ShouldAssertion;
Undefined(): ShouldAssertion;
Null(): ShouldAssertion;
Promise(): ShouldAssertion;
generator(): ShouldAssertion;
iterable(): ShouldAssertion;
iterator(): ShouldAssertion;
@@ -92,6 +93,15 @@ interface ShouldAssertion {
endWith(expected: string, message?: any): ShouldAssertion;
throw(message?: any): ShouldAssertion;
//promises
eventually: ShouldAssertion;
finally: ShouldAssertion;
fulfilled(): Promise<any>;
fulfilledWith(value: any): Promise<any>
rejected(): Promise<any>;
rejectedWith(message: (string | Function | RegExp), properties?: Object): Promise<any>;
rejectedWith(errType: Object): Promise<any>;
//http
header(field: string, val?: string): ShouldAssertion;
status(code: number): ShouldAssertion;