|
| 1 | +// flow-typed signature: e5aa81c42ca6ea865682f7caf64c5940 |
| 2 | +// flow-typed version: be297a96f4/chai_v3.5.x/flow_>=v0.24.0 |
| 3 | + |
| 4 | +/* @flow */ |
| 5 | +declare module "chai" { |
| 6 | + |
| 7 | + declare type ExpectChain<T> = { |
| 8 | + and: ExpectChain<T>, |
| 9 | + at: ExpectChain<T>, |
| 10 | + be: ExpectChain<T>, |
| 11 | + been: ExpectChain<T>, |
| 12 | + have: ExpectChain<T>, |
| 13 | + has: ExpectChain<T>, |
| 14 | + is: ExpectChain<T>, |
| 15 | + of: ExpectChain<T>, |
| 16 | + same: ExpectChain<T>, |
| 17 | + that: ExpectChain<T>, |
| 18 | + to: ExpectChain<T>, |
| 19 | + which: ExpectChain<T>, |
| 20 | + with: ExpectChain<T>, |
| 21 | + |
| 22 | + not: ExpectChain<T>, |
| 23 | + deep: ExpectChain<T>, |
| 24 | + any: ExpectChain<T>, |
| 25 | + all: ExpectChain<T>, |
| 26 | + |
| 27 | + a: ExpectChain<T> & (type: string) => ExpectChain<T>, |
| 28 | + an: ExpectChain<T> & (type: string) => ExpectChain<T>, |
| 29 | + |
| 30 | + include: ExpectChain<T> & (value: mixed) => ExpectChain<T>, |
| 31 | + includes: ExpectChain<T> & (value: mixed) => ExpectChain<T>, |
| 32 | + contain: ExpectChain<T> & (value: mixed) => ExpectChain<T>, |
| 33 | + contains: ExpectChain<T> & (value: mixed) => ExpectChain<T>, |
| 34 | + |
| 35 | + eql: (value: T) => ExpectChain<T>, |
| 36 | + equal: (value: T) => ExpectChain<T>, |
| 37 | + equals: (value: T) => ExpectChain<T>, |
| 38 | + |
| 39 | + above: (value: T & number) => ExpectChain<T>, |
| 40 | + least: (value: T & number) => ExpectChain<T>, |
| 41 | + below: (value: T & number) => ExpectChain<T>, |
| 42 | + most: (value: T & number) => ExpectChain<T>, |
| 43 | + within: (start: T & number, finish: T & number) => ExpectChain<T>, |
| 44 | + |
| 45 | + instanceof: (constructor: mixed) => ExpectChain<T>, |
| 46 | + property: ( |
| 47 | + <P>(name: string, value?: P) => ExpectChain<P> |
| 48 | + & (name: string) => ExpectChain<mixed> |
| 49 | + ), |
| 50 | + |
| 51 | + length: ExpectChain<number>, |
| 52 | + lengthOf: (value: number) => ExpectChain<T>, |
| 53 | + |
| 54 | + match: (regex: RegExp) => ExpectChain<T>, |
| 55 | + string: (string: string) => ExpectChain<T>, |
| 56 | + |
| 57 | + key: (key: string) => ExpectChain<T>, |
| 58 | + keys: (key: string | Array<string>, ...keys: Array<string>) => ExpectChain<T>, |
| 59 | + |
| 60 | + throw: <E>(err: Class<E> | Error | RegExp | string, msg?: RegExp | string) => ExpectChain<T>, |
| 61 | + |
| 62 | + respondTo: (method: string) => ExpectChain<T>, |
| 63 | + itself: ExpectChain<T>, |
| 64 | + |
| 65 | + satisfy: (method: (value: T) => bool) => ExpectChain<T>, |
| 66 | + |
| 67 | + closeTo: (expected: T & number, delta: number) => ExpectChain<T>, |
| 68 | + |
| 69 | + members: (set: mixed) => ExpectChain<T>, |
| 70 | + oneOf: (list: Array<T>) => ExpectChain<T>, |
| 71 | + |
| 72 | + change: (obj: mixed, key: string) => ExpectChain<T>, |
| 73 | + increase: (obj: mixed, key: string) => ExpectChain<T>, |
| 74 | + decrease: (obj: mixed, key: string) => ExpectChain<T>, |
| 75 | + |
| 76 | + // dirty-chai |
| 77 | + ok: () => ExpectChain<T>, |
| 78 | + true: () => ExpectChain<T>, |
| 79 | + false: () => ExpectChain<T>, |
| 80 | + null: () => ExpectChain<T>, |
| 81 | + undefined: () => ExpectChain<T>, |
| 82 | + exist: () => ExpectChain<T>, |
| 83 | + empty: () => ExpectChain<T>, |
| 84 | + |
| 85 | + // chai-immutable |
| 86 | + size: (n: number) => ExpectChain<T>, |
| 87 | + |
| 88 | + // sinon-chai |
| 89 | + called: () => ExpectChain<T>, |
| 90 | + callCount: (n: number) => ExpectChain<T>, |
| 91 | + calledOnce: () => ExpectChain<T>, |
| 92 | + calledBefore: (spy: mixed) => ExpectChain<T>, |
| 93 | + calledAfter: (spy: mixed) => ExpectChain<T>, |
| 94 | + calledWith: (...args: Array<mixed>) => ExpectChain<T>, |
| 95 | + calledWithMatch: (...args: Array<mixed>) => ExpectChain<T>, |
| 96 | + calledWithExactly: (...args: Array<mixed>) => ExpectChain<T>, |
| 97 | + }; |
| 98 | + |
| 99 | + declare function expect<T>(actual: T): ExpectChain<T>; |
| 100 | + |
| 101 | + declare function use(plugin: (chai: Object, utils: Object) => void): void; |
| 102 | + |
| 103 | + declare class assert { |
| 104 | + static(expression: mixed, message?: string): void; |
| 105 | + static fail(actual: mixed, expected: mixed, message?: string, operator?: string): void; |
| 106 | + |
| 107 | + static isOk(object: mixed, message?: string): void; |
| 108 | + static isNotOk(object: mixed, message?: string): void; |
| 109 | + |
| 110 | + static equal(actual: mixed, expected: mixed, message?: string): void; |
| 111 | + static notEqual(actual: mixed, expected: mixed, message?: string): void; |
| 112 | + |
| 113 | + static strictEqual(act: mixed, exp: mixed, msg?: string): void; |
| 114 | + static notStrictEqual(act: mixed, exp: mixed, msg?: string): void; |
| 115 | + |
| 116 | + static deepEqual(act: mixed, exp: mixed, msg?: string): void; |
| 117 | + static notDeepEqual(act: mixed, exp: mixed, msg?: string): void; |
| 118 | + |
| 119 | + static isTrue(val: mixed, msg?: string): void; |
| 120 | + static isNotTrue(val: mixed, msg?: string): void; |
| 121 | + static isFalse(val: mixed, msg?: string): void; |
| 122 | + static isNotFalse(val: mixed, msg?: string): void; |
| 123 | + |
| 124 | + static isNull(val: mixed, msg?: string): void; |
| 125 | + static isNotNull(val: mixed, msg?: string): void; |
| 126 | + |
| 127 | + static isUndefined(val: mixed, msg?: string): void; |
| 128 | + static isDefined(val: mixed, msg?: string): void; |
| 129 | + |
| 130 | + static isNaN(val: mixed, msg?: string): void; |
| 131 | + static isNotNaN(val: mixed, msg?: string): void; |
| 132 | + |
| 133 | + static isAbove(val: number, abv: number, msg?: string): void; |
| 134 | + static isBelow(val: number, blw: number, msg?: string): void; |
| 135 | + |
| 136 | + static isAtMost(val: number, atmst: number, msg?: string): void; |
| 137 | + static isAtLeast(val: number, atlst: number, msg?: string): void; |
| 138 | + |
| 139 | + static isFunction(val: mixed, msg?: string): void; |
| 140 | + static isNotFunction(val: mixed, msg?: string): void; |
| 141 | + |
| 142 | + static isObject(val: mixed, msg?: string): void; |
| 143 | + static isNotObject(val: mixed, msg?: string): void; |
| 144 | + |
| 145 | + static isArray(val: mixed, msg?: string): void; |
| 146 | + static isNotArray(val: mixed, msg?: string): void; |
| 147 | + |
| 148 | + static isString(val: mixed, msg?: string): void; |
| 149 | + static isNotString(val: mixed, msg?: string): void; |
| 150 | + |
| 151 | + static isNumber(val: mixed, msg?: string): void; |
| 152 | + static isNotNumber(val: mixed, msg?: string): void; |
| 153 | + |
| 154 | + static isBoolean(val: mixed, msg?: string): void; |
| 155 | + static isNotBoolean(val: mixed, msg?: string): void; |
| 156 | + |
| 157 | + static typeOf(val: mixed, type: string, msg?: string): void; |
| 158 | + static notTypeOf(val: mixed, type: string, msg?: string): void; |
| 159 | + |
| 160 | + static instanceOf(val: mixed, constructor: Function, msg?: string): void; |
| 161 | + static notInstanceOf(val: mixed, constructor: Function, msg?: string): void; |
| 162 | + |
| 163 | + static include(exp: string, inc: mixed, msg?: string): void; |
| 164 | + static include(exp: Array<mixed>, inc: mixed, msg?: string): void; |
| 165 | + |
| 166 | + static notInclude(exp: string, inc: mixed, msg?: string): void; |
| 167 | + static notInclude(exp: Array<mixed>, inc: mixed, msg?: string): void; |
| 168 | + |
| 169 | + static match(exp: mixed, re: RegExp, msg?: string): void; |
| 170 | + static notMatch(exp: mixed, re: RegExp, msg?: string): void; |
| 171 | + |
| 172 | + static property(obj: Object, prop: string, msg?: string): void; |
| 173 | + static notProperty(obj: Object, prop: string, msg?: string): void; |
| 174 | + static deepProperty(obj: Object, prop: string, msg?: string): void; |
| 175 | + static notDeepProperty(obj: Object, prop: string, msg?: string): void; |
| 176 | + |
| 177 | + static propertyVal(obj: Object, prop: string, val: mixed, msg?: string): void; |
| 178 | + static propertyNotVal(obj: Object, prop: string, val: mixed, msg?: string): void; |
| 179 | + |
| 180 | + static deepPropertyVal(obj: Object, prop: string, val: mixed, msg?: string): void; |
| 181 | + static deepPropertyNotVal(obj: Object, prop: string, val: mixed, msg?: string): void; |
| 182 | + |
| 183 | + static lengthOf(exp: mixed, len: number, msg?: string): void; |
| 184 | + } |
| 185 | + |
| 186 | + declare var config: { |
| 187 | + includeStack: boolean, |
| 188 | + showDiff: boolean, |
| 189 | + truncateThreshold: boolean |
| 190 | + }; |
| 191 | +} |
0 commit comments