From f33b34e97c9461e25ba496a58052caa5df43cb6c Mon Sep 17 00:00:00 2001 From: Matthew Hill Date: Mon, 29 Jun 2015 22:41:03 +0100 Subject: [PATCH] adds type definitions for jasmine-promise-matchers --- .../jasmine-promise-matchers-tests.ts | 17 ++++++++++ .../jasmine-promise-matchers.d.ts | 33 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 jasmine-promise-matchers/jasmine-promise-matchers-tests.ts create mode 100644 jasmine-promise-matchers/jasmine-promise-matchers.d.ts 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