// Type definitions for chai-as-promised // Project: https://github.com/domenic/chai-as-promised/ // Definitions by: jt000 , Yuki Kokubun // Definitions: https://github.com/borisyankov/DefinitelyTyped /// /// declare module 'chai-as-promised' { function chaiAsPromised(chai: any, utils: any): void; namespace chaiAsPromised {} export = chaiAsPromised; } declare module Chai { // For BDD API interface Assertion extends LanguageChains, NumericComparison, TypeComparison { eventually: PromisedAssertion; become(expected: any): PromisedAssertion; fulfilled: PromisedAssertion; rejected: PromisedAssertion; rejectedWith(expected: any, message?: string | RegExp): PromisedAssertion; notify(fn: Function): PromisedAssertion; } // Eventually does not have .then(), but PromisedAssertion have. interface Eventually extends PromisedLanguageChains, PromisedNumericComparison, PromisedTypeComparison { // From chai-as-promised become(expected: PromisesAPlus.Thenable): PromisedAssertion; fulfilled: PromisedAssertion; rejected: PromisedAssertion; rejectedWith(expected: any, message?: string | RegExp): PromisedAssertion; notify(fn: Function): PromisedAssertion; // From chai not: PromisedAssertion; deep: PromisedDeep; a: PromisedTypeComparison; an: PromisedTypeComparison; include: PromisedInclude; contain: PromisedInclude; ok: PromisedAssertion; true: PromisedAssertion; false: PromisedAssertion; null: PromisedAssertion; undefined: PromisedAssertion; exist: PromisedAssertion; empty: PromisedAssertion; arguments: PromisedAssertion; Arguments: PromisedAssertion; equal: PromisedEqual; equals: PromisedEqual; eq: PromisedEqual; eql: PromisedEqual; eqls: PromisedEqual; property: PromisedProperty; ownProperty: PromisedOwnProperty; haveOwnProperty: PromisedOwnProperty; length: PromisedLength; lengthOf: PromisedLength; match(regexp: RegExp|string, message?: string): PromisedAssertion; string(string: string, message?: string): PromisedAssertion; keys: PromisedKeys; key(string: string): PromisedAssertion; throw: PromisedThrow; throws: PromisedThrow; Throw: PromisedThrow; respondTo(method: string, message?: string): PromisedAssertion; itself: PromisedAssertion; satisfy(matcher: Function, message?: string): PromisedAssertion; closeTo(expected: number, delta: number, message?: string): PromisedAssertion; members: PromisedMembers; } interface PromisedAssertion extends Eventually, PromisesAPlus.Thenable { } interface PromisedLanguageChains { eventually: Eventually; // From chai to: PromisedAssertion; be: PromisedAssertion; been: PromisedAssertion; is: PromisedAssertion; that: PromisedAssertion; which: PromisedAssertion; and: PromisedAssertion; has: PromisedAssertion; have: PromisedAssertion; with: PromisedAssertion; at: PromisedAssertion; of: PromisedAssertion; same: PromisedAssertion; } interface PromisedNumericComparison { above: PromisedNumberComparer; gt: PromisedNumberComparer; greaterThan: PromisedNumberComparer; least: PromisedNumberComparer; gte: PromisedNumberComparer; below: PromisedNumberComparer; lt: PromisedNumberComparer; lessThan: PromisedNumberComparer; most: PromisedNumberComparer; lte: PromisedNumberComparer; within(start: number, finish: number, message?: string): PromisedAssertion; } interface PromisedNumberComparer { (value: number, message?: string): PromisedAssertion; } interface PromisedTypeComparison { (type: string, message?: string): PromisedAssertion; instanceof: PromisedInstanceOf; instanceOf: PromisedInstanceOf; } interface PromisedInstanceOf { (constructor: Object, message?: string): PromisedAssertion; } interface PromisedDeep { equal: PromisedEqual; include: PromisedInclude; property: PromisedProperty; } interface PromisedEqual { (value: any, message?: string): PromisedAssertion; } interface PromisedProperty { (name: string, value?: any, message?: string): PromisedAssertion; } interface PromisedOwnProperty { (name: string, message?: string): PromisedAssertion; } interface PromisedLength extends PromisedLanguageChains, PromisedNumericComparison { (length: number, message?: string): PromisedAssertion; } interface PromisedInclude { (value: Object, message?: string): PromisedAssertion; (value: string, message?: string): PromisedAssertion; (value: number, message?: string): PromisedAssertion; keys: PromisedKeys; members: PromisedMembers; } interface PromisedKeys { (...keys: string[]): PromisedAssertion; (keys: any[]): PromisedAssertion; } interface PromisedThrow { (): PromisedAssertion; (expected: string, message?: string): PromisedAssertion; (expected: RegExp, message?: string): PromisedAssertion; (constructor: Error, expected?: string, message?: string): PromisedAssertion; (constructor: Error, expected?: RegExp, message?: string): PromisedAssertion; (constructor: Function, expected?: string, message?: string): PromisedAssertion; (constructor: Function, expected?: RegExp, message?: string): PromisedAssertion; } interface PromisedMembers { (set: any[], message?: string): PromisedAssertion; } // For Assert API interface Assert { eventually: PromisedAssert; isFulfilled(promise: PromisesAPlus.Thenable, message?: string): PromisesAPlus.Thenable; becomes(promise: PromisesAPlus.Thenable, expected: any, message?: string): PromisesAPlus.Thenable; doesNotBecome(promise: PromisesAPlus.Thenable, expected: any, message?: string): PromisesAPlus.Thenable; isRejected(promise: PromisesAPlus.Thenable, message?: string): PromisesAPlus.Thenable; isRejected(promise: PromisesAPlus.Thenable, expected: any, message?: string): PromisesAPlus.Thenable; isRejected(promise: PromisesAPlus.Thenable, match: RegExp, message?: string): PromisesAPlus.Thenable; notify(fn: Function): PromisesAPlus.Thenable; } export interface PromisedAssert { fail(actual?: any, expected?: any, msg?: string, operator?: string): PromisesAPlus.Thenable; ok(val: any, msg?: string): PromisesAPlus.Thenable; notOk(val: any, msg?: string): PromisesAPlus.Thenable; equal(act: any, exp: any, msg?: string): PromisesAPlus.Thenable; notEqual(act: any, exp: any, msg?: string): PromisesAPlus.Thenable; strictEqual(act: any, exp: any, msg?: string): PromisesAPlus.Thenable; notStrictEqual(act: any, exp: any, msg?: string): PromisesAPlus.Thenable; deepEqual(act: any, exp: any, msg?: string): PromisesAPlus.Thenable; notDeepEqual(act: any, exp: any, msg?: string): PromisesAPlus.Thenable; isTrue(val: any, msg?: string): PromisesAPlus.Thenable; isFalse(val: any, msg?: string): PromisesAPlus.Thenable; isNull(val: any, msg?: string): PromisesAPlus.Thenable; isNotNull(val: any, msg?: string): PromisesAPlus.Thenable; isUndefined(val: any, msg?: string): PromisesAPlus.Thenable; isDefined(val: any, msg?: string): PromisesAPlus.Thenable; isFunction(val: any, msg?: string): PromisesAPlus.Thenable; isNotFunction(val: any, msg?: string): PromisesAPlus.Thenable; isObject(val: any, msg?: string): PromisesAPlus.Thenable; isNotObject(val: any, msg?: string): PromisesAPlus.Thenable; isArray(val: any, msg?: string): PromisesAPlus.Thenable; isNotArray(val: any, msg?: string): PromisesAPlus.Thenable; isString(val: any, msg?: string): PromisesAPlus.Thenable; isNotString(val: any, msg?: string): PromisesAPlus.Thenable; isNumber(val: any, msg?: string): PromisesAPlus.Thenable; isNotNumber(val: any, msg?: string): PromisesAPlus.Thenable; isBoolean(val: any, msg?: string): PromisesAPlus.Thenable; isNotBoolean(val: any, msg?: string): PromisesAPlus.Thenable; typeOf(val: any, type: string, msg?: string): PromisesAPlus.Thenable; notTypeOf(val: any, type: string, msg?: string): PromisesAPlus.Thenable; instanceOf(val: any, type: Function, msg?: string): PromisesAPlus.Thenable; notInstanceOf(val: any, type: Function, msg?: string): PromisesAPlus.Thenable; include(exp: string, inc: any, msg?: string): PromisesAPlus.Thenable; include(exp: any[], inc: any, msg?: string): PromisesAPlus.Thenable; notInclude(exp: string, inc: any, msg?: string): PromisesAPlus.Thenable; notInclude(exp: any[], inc: any, msg?: string): PromisesAPlus.Thenable; match(exp: any, re: RegExp, msg?: string): PromisesAPlus.Thenable; notMatch(exp: any, re: RegExp, msg?: string): PromisesAPlus.Thenable; property(obj: Object, prop: string, msg?: string): PromisesAPlus.Thenable; notProperty(obj: Object, prop: string, msg?: string): PromisesAPlus.Thenable; deepProperty(obj: Object, prop: string, msg?: string): PromisesAPlus.Thenable; notDeepProperty(obj: Object, prop: string, msg?: string): PromisesAPlus.Thenable; propertyVal(obj: Object, prop: string, val: any, msg?: string): PromisesAPlus.Thenable; propertyNotVal(obj: Object, prop: string, val: any, msg?: string): PromisesAPlus.Thenable; deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): PromisesAPlus.Thenable; deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): PromisesAPlus.Thenable; lengthOf(exp: any, len: number, msg?: string): PromisesAPlus.Thenable; //alias frenzy throw(fn: Function, msg?: string): PromisesAPlus.Thenable; throw(fn: Function, regExp: RegExp): PromisesAPlus.Thenable; throw(fn: Function, errType: Function, msg?: string): PromisesAPlus.Thenable; throw(fn: Function, errType: Function, regExp: RegExp): PromisesAPlus.Thenable; throws(fn: Function, msg?: string): PromisesAPlus.Thenable; throws(fn: Function, regExp: RegExp): PromisesAPlus.Thenable; throws(fn: Function, errType: Function, msg?: string): PromisesAPlus.Thenable; throws(fn: Function, errType: Function, regExp: RegExp): PromisesAPlus.Thenable; Throw(fn: Function, msg?: string): PromisesAPlus.Thenable; Throw(fn: Function, regExp: RegExp): PromisesAPlus.Thenable; Throw(fn: Function, errType: Function, msg?: string): PromisesAPlus.Thenable; Throw(fn: Function, errType: Function, regExp: RegExp): PromisesAPlus.Thenable; doesNotThrow(fn: Function, msg?: string): PromisesAPlus.Thenable; doesNotThrow(fn: Function, regExp: RegExp): PromisesAPlus.Thenable; doesNotThrow(fn: Function, errType: Function, msg?: string): PromisesAPlus.Thenable; doesNotThrow(fn: Function, errType: Function, regExp: RegExp): PromisesAPlus.Thenable; operator(val: any, operator: string, val2: any, msg?: string): PromisesAPlus.Thenable; closeTo(act: number, exp: number, delta: number, msg?: string): PromisesAPlus.Thenable; sameMembers(set1: any[], set2: any[], msg?: string): PromisesAPlus.Thenable; includeMembers(set1: any[], set2: any[], msg?: string): PromisesAPlus.Thenable; ifError(val: any, msg?: string): PromisesAPlus.Thenable; } }