// Type definitions for Expect 1.20 // Project: https://github.com/mjackson/expect // Definitions by: Justin Reidy , Risto Keravuori // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace expect { type CompareValues = (a: T, b: T) => boolean; type Comparator = (target: {}, key: string) => boolean; type KeyType = string | number; class Expectation { constructor(actual: any); toExist(message?: string): Expectation; toBeTruthy(message?: string): Expectation; toNotExist(message?: string): Expectation; toBeFalsy(message?: string): Expectation; toBe(value: T, message?: string): Expectation; toNotBe(value: any, message?: string): Expectation; toEqual(value: any, message?: string): Expectation; toNotEqual(value: any, message?: string): Expectation; toThrow(error?: {}, message?: string): Expectation; toNotThrow(error?: {}, message?: string): Expectation; toBeA(value: string | {}, message?: string): Expectation; toBeAn(value: string | {}, message?: string): Expectation; toNotBeA(value: string | {}, message?: string): Expectation; toNotBeAn(value: string | {}, message?: string): Expectation; toMatch(value: string | RegExp | {}, message?: string): Expectation; toNotMatch(value: string | RegExp | {}, message?: string): Expectation; toBeLessThan(value: number, message?: string): Expectation; toBeLessThanOrEqualTo(value: number, messasge?: string): Expectation; toBeFewerThan(value: number, message?: string): Expectation; toBeGreaterThan(value: number, message?: string): Expectation; toBeGreaterThanOrEqualTo(value: number, messasge?: string): Expectation; toBeMoreThan(value: number, message?: string): Expectation; toInclude(value: any, compareValues?: CompareValues, message?: string): Expectation; toContain(value: any, compareValues?: CompareValues, message?: string): Expectation; toExclude(value: any, compareValues?: CompareValues, message?: string): Expectation; toNotContain(value: any, compareValues?: CompareValues, message?: string): Expectation; toIncludeKeys(keys: KeyType[], comparator?: Comparator, message?: string): Expectation; toContainKeys(keys: KeyType[], comparator?: Comparator, message?: string): Expectation; toExcludeKeys(keys: KeyType[], comparator?: Comparator, message?: string): Expectation; toNotContainKeys(keys: KeyType[], comparator?: Comparator, message?: string): Expectation; toNotIncludeKeys(keys: KeyType[], comparator?: Comparator, message?: string): Expectation; toIncludeKey(key: KeyType, comparator?: Comparator, message?: string): Expectation; toContainKey(key: KeyType, comparator?: Comparator, message?: string): Expectation; toExcludeKey(key: KeyType, comparator?: Comparator, message?: string): Expectation; toNotContainKey(key: KeyType, comparator?: Comparator, message?: string): Expectation; toNotIncludeKey(key: KeyType, comparator?: Comparator, message?: string): Expectation; toHaveBeenCalled(message?: string): Expectation; toNotHaveBeenCalled(message?: string): Expectation; toHaveBeenCalledWith(...args: any[]): Expectation; // deprecated withContext(context: any): Expectation; withArgs(...args: any[]): Expectation; } interface Extension { [name: string]: (args?: any[]) => void; } interface Call { context: T; arguments: any[]; } interface Spy { (...args: any[]): void; __isSpy: boolean; calls: Array>; andCall(fn: (...args: any[]) => any): Spy; andCallThrough(): Spy; andThrow(object: {}): Spy; andReturn(value: any): Spy; getLastCall(): Call; restore(): void; destroy(): void; reset(): void; } function createSpy(fn?: (...args: any[]) => any, restore?: (...args: any[]) => any): Spy; function spyOn(object: T, methodName: string): Spy; function isSpy(object: {}): boolean; function restoreSpies(): void; function assert(condition: boolean, messageFormat: string, ...extraArgs: any[]): void; function extend(extension: Extension): void; } declare function expect(actual: T): expect.Expectation; export = expect;