Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#4766 from matthewjh/jasmine-promis…
Browse files Browse the repository at this point in the history
…e-matchers-2

adds type definitions for jasmine-promise-matchers
  • Loading branch information
vvakame committed Jul 3, 2015
2 parents e8d2a61 + f33b34e commit 956b9a0
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
17 changes: 17 additions & 0 deletions jasmine-promise-matchers/jasmine-promise-matchers-tests.ts
Original file line number Diff line number Diff line change
@@ -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();
});
})
33 changes: 33 additions & 0 deletions jasmine-promise-matchers/jasmine-promise-matchers.d.ts
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit 956b9a0

Please sign in to comment.