Added definitions for jasmine-es6-promise-matchers

This commit is contained in:
Stephen Lautier 2015-09-14 21:25:58 +02:00
parent 7a3ca1f0b8
commit 2b368d620f
2 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,21 @@
/// <reference path="jasmine-es6-promise-matchers.d.ts" />
describe('specs', () => {
beforeEach(() => {
JasminePromiseMatchers.install
});
afterEach(() => {
JasminePromiseMatchers.uninstall
});
it('should have correct syntax', (done) => {
var foo = {};
var bar = {};
expect(foo).toBeResolvedWith(bar, done);
expect(foo).toBeRejectedWith(bar, done);
expect(foo).toBeResolved(done);
expect(foo).toBeRejected(done);
});
})

View File

@ -0,0 +1,36 @@
// Type definitions for jasmine-es6-promise-matchers
// Project: https://github.com/bvaughn/jasmine-es6-promise-matchers
// Definitions by: Stephen Lautier <https://github.com/stephenlautier>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jasmine/jasmine.d.ts" />
declare module JasminePromiseMatchers {
export function install():void;
export function uninstall():void;
}
declare module jasmine {
interface Matchers {
/**
* Verifies that a Promise is (or has been) rejected.
*/
toBeRejected(done?: () => void): boolean;
/**
* Verifies that a Promise is (or has been) rejected with the specified parameter.
*/
toBeRejectedWith(value: any, done?: () => void): boolean;
/**
* Verifies that a Promise is (or has been) resolved.
*/
toBeResolved(done?: () => void): boolean;
/**
* Verifies that a Promise is (or has been) resolved with the specified parameter.
*/
toBeResolvedWith(value: any, done?: () => void): boolean;
}
}