adds type definitions for jasmine-promise-matchers

This commit is contained in:
Matthew Hill 2015-06-29 22:41:03 +01:00
parent 6f04d25ad3
commit f33b34e97c
2 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,17 @@
/// <reference path="jasmine-promise-matchers.d.ts" />
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();
});
})

View File

@ -0,0 +1,33 @@
// Type definitions for jasmine-promise-matchers
// Project: https://github.com/bvaughn/jasmine-promise-matchers
// Definitions by: Matthew Hill <https://github.com/matthewjh>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jasmine/jasmine.d.ts" />
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;
}
}