From 2b368d620fdc997bbbf3c7913c19bfa9ce6aa55c Mon Sep 17 00:00:00 2001 From: Stephen Lautier Date: Mon, 14 Sep 2015 21:25:58 +0200 Subject: [PATCH] Added definitions for jasmine-es6-promise-matchers --- .../jasmine-es6-promise-matchers-tests.ts | 21 +++++++++++ .../jasmine-es6-promise-matchers.d.ts | 36 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 jasmine-es6-promise-matchers/jasmine-es6-promise-matchers-tests.ts create mode 100644 jasmine-es6-promise-matchers/jasmine-es6-promise-matchers.d.ts diff --git a/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers-tests.ts b/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers-tests.ts new file mode 100644 index 0000000000..d2917e7612 --- /dev/null +++ b/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers-tests.ts @@ -0,0 +1,21 @@ +/// + +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); + }); +}) \ No newline at end of file diff --git a/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers.d.ts b/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers.d.ts new file mode 100644 index 0000000000..1735e51bcb --- /dev/null +++ b/jasmine-es6-promise-matchers/jasmine-es6-promise-matchers.d.ts @@ -0,0 +1,36 @@ +// Type definitions for jasmine-es6-promise-matchers +// Project: https://github.com/bvaughn/jasmine-es6-promise-matchers +// Definitions by: Stephen Lautier +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +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; + } +} \ No newline at end of file