diff --git a/jasmine-promise-matchers/jasmine-promise-matchers-tests.ts b/jasmine-promise-matchers/jasmine-promise-matchers-tests.ts new file mode 100644 index 00000000000000..28eb34aa1cca96 --- /dev/null +++ b/jasmine-promise-matchers/jasmine-promise-matchers-tests.ts @@ -0,0 +1,17 @@ +/// + +describe('something', () => { + beforeEach(() => { + installPromiseMatchers(); + }); + + it('should do something', () => { + var foo = {}; + var bar = {}; + + expect(foo).toBeResolvedWith(bar); + expect(foo).toBeRejectedWith(bar); + expect(foo).toBeResolved(); + expect(foo).toBeRejected(); + }); +}) \ No newline at end of file diff --git a/jasmine-promise-matchers/jasmine-promise-matchers.d.ts b/jasmine-promise-matchers/jasmine-promise-matchers.d.ts new file mode 100644 index 00000000000000..92bec644a27d64 --- /dev/null +++ b/jasmine-promise-matchers/jasmine-promise-matchers.d.ts @@ -0,0 +1,33 @@ +// Type definitions for jasmine-promise-matchers +// Project: https://github.com/bvaughn/jasmine-promise-matchers +// Definitions by: Matthew Hill +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare function installPromiseMatchers(): void; + +declare module jasmine { + + interface Matchers { + /** + * Verifies that a Promise is (or has been) rejected. + */ + toBeRejected(): boolean; + + /** + * Verifies that a Promise is (or has been) rejected with the specified parameter. + */ + toBeRejectedWith(value: any): boolean; + + /** + * Verifies that a Promise is (or has been) resolved. + */ + toBeResolved(): boolean; + + /** + * Verifies that a Promise is (or has been) resolved with the specified parameter. + */ + toBeResolvedWith(value: any): boolean; + } +} \ No newline at end of file