types/jasmine-promise-matchers: add toBePromise matcher (#34858)

This commit is contained in:
Marcin Wosinek 2019-04-24 21:44:40 +01:00 committed by Pranav Senthilnathan
parent 308c13ed4d
commit a358c583ff
2 changed files with 7 additions and 1 deletions

View File

@ -11,6 +11,11 @@ declare function installPromiseMatchers(): void;
declare namespace jasmine {
interface Matchers <T>{
/**
* Verifies that a value is a $q Promise.
*/
toBePromise(): boolean
/**
* Verifies that a Promise is (or has been) rejected.
*/

View File

@ -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();