mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 19:09:18 +08:00
Re-adding chai-as-promised (prior commit contained no content)
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
/// <reference path="../chai/chai.d.ts" />
|
||||
/// <reference path="chai-as-promised.d.ts" />
|
||||
|
||||
import chai = require('chai');
|
||||
import chaiAsPromised = require('chai-as-promised');
|
||||
|
||||
chai.use(chaiAsPromised);
|
||||
|
||||
var promise: any;
|
||||
chai.expect(promise).to.eventually.equal(3);
|
||||
chai.expect(promise).to.become(3);
|
||||
chai.expect(promise).to.be.rejected;
|
||||
chai.expect(promise).to.be.rejectedWith(Error);
|
||||
chai.expect(promise).to.notify(() => console.log('done'));
|
||||
|
||||
chai.assert.eventually.equal(promise, 4, 'Message');
|
||||
chai.assert.isFulfilled(promise, "optional message");
|
||||
chai.assert.becomes(promise, "foo", "optional message");
|
||||
chai.assert.doesNotBecome(promise, "foo", "optional message");
|
||||
chai.assert.isRejected(promise, "optional message");
|
||||
chai.assert.isRejected(promise, Error, "optional message");
|
||||
chai.assert.isRejected(promise, /error message matcher/, "optional message");
|
||||
|
||||
35
chai-as-promised/chai-as-promised.d.ts
vendored
35
chai-as-promised/chai-as-promised.d.ts
vendored
@@ -0,0 +1,35 @@
|
||||
// Type definitions for chai-as-promised
|
||||
// Project: https://github.com/domenic/chai-as-promised/
|
||||
// Definitions by: jt000 <https://github.com/jt000>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../chai/chai.d.ts" />
|
||||
|
||||
declare module 'chai-as-promised' {
|
||||
import chai = require('chai');
|
||||
|
||||
function chaiAsPromised(chai: any, utils: any): void;
|
||||
|
||||
export = chaiAsPromised;
|
||||
}
|
||||
|
||||
declare module chai {
|
||||
|
||||
interface LanguageChains {
|
||||
become(expected: any): Expect;
|
||||
eventually: Expect;
|
||||
rejected: Expect;
|
||||
rejectedWith(expected: any): Expect;
|
||||
notify(fn: Function): Expect;
|
||||
}
|
||||
|
||||
interface Assert {
|
||||
eventually: Assert;
|
||||
isFulfilled(promise: any, message?: string): void;
|
||||
becomes(promise: any, expected: any, message?: string): void;
|
||||
doesNotBecome(promise: any, expected: any, message?: string): void;
|
||||
isRejected(promise: any, message?: string): void;
|
||||
isRejected(promise: any, expected: any, message?: string): void;
|
||||
isRejected(promise: any, match: RegExp, message?: string): void;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user