From a358c583fff55f7ea13bf685ca3f501dd960f8db Mon Sep 17 00:00:00 2001 From: Marcin Wosinek Date: Wed, 24 Apr 2019 21:44:40 +0100 Subject: [PATCH] types/jasmine-promise-matchers: add toBePromise matcher (#34858) --- types/jasmine-promise-matchers/index.d.ts | 5 +++++ .../jasmine-promise-matchers-tests.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/types/jasmine-promise-matchers/index.d.ts b/types/jasmine-promise-matchers/index.d.ts index 3c05b5304e..ea001c711f 100644 --- a/types/jasmine-promise-matchers/index.d.ts +++ b/types/jasmine-promise-matchers/index.d.ts @@ -11,6 +11,11 @@ declare function installPromiseMatchers(): void; declare namespace jasmine { interface Matchers { + /** + * Verifies that a value is a $q Promise. + */ + toBePromise(): boolean + /** * Verifies that a Promise is (or has been) rejected. */ diff --git a/types/jasmine-promise-matchers/jasmine-promise-matchers-tests.ts b/types/jasmine-promise-matchers/jasmine-promise-matchers-tests.ts index 6ea4d32b94..dd3ac2fc8d 100644 --- a/types/jasmine-promise-matchers/jasmine-promise-matchers-tests.ts +++ b/types/jasmine-promise-matchers/jasmine-promise-matchers-tests.ts @@ -8,7 +8,8 @@ describe('something', () => { it('should do something', () => { var foo = {}; var bar = {}; - + + expect(foo).toBePromise(); expect(foo).toBeResolvedWith(bar); expect(foo).toBeRejectedWith(bar); expect(foo).toBeResolved();