|
| 1 | +// Type definitions for should.js 3.1.2 |
| 2 | +// Project: https://github.com/visionmedia/should.js |
| 3 | +// Definitions by: Alex Varju <https://github.com/varju/>, Maxime LUCE <https://github.com/SomaticIT/> |
| 4 | +// Definitions: https://github.com/borisyankov/DefinitelyTyped |
| 5 | + |
| 6 | +interface Object { |
| 7 | + should: ShouldAssertion; |
| 8 | +} |
| 9 | + |
| 10 | +interface ShouldAssertion { |
| 11 | + // basic grammar |
| 12 | + a: ShouldAssertion; |
| 13 | + an: ShouldAssertion; |
| 14 | + and: ShouldAssertion; |
| 15 | + be: ShouldAssertion; |
| 16 | + have: ShouldAssertion; |
| 17 | + with: ShouldAssertion; |
| 18 | + of: ShouldAssertion; |
| 19 | + not: ShouldAssertion; |
| 20 | + |
| 21 | + // validators |
| 22 | + arguments: ShouldAssertion; |
| 23 | + empty: ShouldAssertion; |
| 24 | + ok: ShouldAssertion; |
| 25 | + true: ShouldAssertion; |
| 26 | + false: ShouldAssertion; |
| 27 | + NaN: ShouldAssertion; |
| 28 | + Infinity: ShouldAssertion; |
| 29 | + Array: ShouldAssertion; |
| 30 | + Object: ShouldAssertion; |
| 31 | + String: ShouldAssertion; |
| 32 | + Boolean: ShouldAssertion; |
| 33 | + Number: ShouldAssertion; |
| 34 | + Error: ShouldAssertion; |
| 35 | + Function: ShouldAssertion; |
| 36 | + eql(expected: any, description?: string): ShouldAssertion; |
| 37 | + equal(expected: any, description?: string): ShouldAssertion; |
| 38 | + within(start: number, finish: number, description?: string): ShouldAssertion; |
| 39 | + approximately(value: number, delta: number, description?: string): ShouldAssertion; |
| 40 | + type(expected: any, description?: string): ShouldAssertion; |
| 41 | + instanceof(constructor: Function, description?: string): ShouldAssertion; |
| 42 | + above(n: number, description?: string): ShouldAssertion; |
| 43 | + below(n: number, description?: string): ShouldAssertion; |
| 44 | + match(other: {}, description?: string): ShouldAssertion; |
| 45 | + match(other: (val: any) => any, description?: string): ShouldAssertion; |
| 46 | + match(regexp: RegExp, description?: string): ShouldAssertion; |
| 47 | + match(other: any, description?: string): ShouldAssertion; |
| 48 | + matchEach(other: {}, description?: string): ShouldAssertion; |
| 49 | + matchEach(other: (val: any) => any, description?: string): ShouldAssertion; |
| 50 | + matchEach(regexp: RegExp, description?: string): ShouldAssertion; |
| 51 | + matchEach(other: any, description?: string): ShouldAssertion; |
| 52 | + length(n: number, description?: string): ShouldAssertion; |
| 53 | + property(name: string, description?: string): ShouldAssertion; |
| 54 | + property(name: string, val: any, description?: string): ShouldAssertion; |
| 55 | + properties(names: string[]): ShouldAssertion; |
| 56 | + properties(name: string): ShouldAssertion; |
| 57 | + properties(descriptor: any): ShouldAssertion; |
| 58 | + properties(...properties: string[]): ShouldAssertion; |
| 59 | + ownProperty(name: string, description?: string): ShouldAssertion; |
| 60 | + contain(obj: any): ShouldAssertion; |
| 61 | + containEql(obj: any): ShouldAssertion; |
| 62 | + containDeep(obj: any): ShouldAssertion; |
| 63 | + keys(...allKeys: string[]): ShouldAssertion; |
| 64 | + keys(allKeys: string[]): ShouldAssertion; |
| 65 | + header(field: string, val?: string): ShouldAssertion; |
| 66 | + status(code: number): ShouldAssertion; |
| 67 | + json: ShouldAssertion; |
| 68 | + html: ShouldAssertion; |
| 69 | + startWith(expected: string, message?: any): ShouldAssertion; |
| 70 | + endWith(expected: string, message?: any): ShouldAssertion; |
| 71 | + throw(message?: any): ShouldAssertion; |
| 72 | + |
| 73 | + // deprecated |
| 74 | + include(obj: any, description?: string): ShouldAssertion; |
| 75 | + includeEql(obj: any[], description?: string): ShouldAssertion; |
| 76 | + |
| 77 | + // aliases |
| 78 | + exactly(expected: any, description?: string): ShouldAssertion; |
| 79 | + instanceOf(constructor: Function, description?: string): ShouldAssertion; |
| 80 | + throwError(message?: any): ShouldAssertion; |
| 81 | + lengthOf(n: number, description?: string): ShouldAssertion; |
| 82 | + key(key: string): ShouldAssertion; |
| 83 | + haveOwnProperty(name: string, description?: string): ShouldAssertion; |
| 84 | + greaterThan(n: number, description?: string): ShouldAssertion; |
| 85 | + lessThan(n: number, description?: string): ShouldAssertion; |
| 86 | +} |
| 87 | + |
| 88 | +interface ShouldInternal { |
| 89 | + // should.js's extras |
| 90 | + exist(actual: any): void; |
| 91 | + exists(actual: any): void; |
| 92 | + not: ShouldInternal; |
| 93 | +} |
| 94 | + |
| 95 | +interface Internal extends ShouldInternal { |
| 96 | + (obj: any): ShouldAssertion; |
| 97 | + |
| 98 | + // node.js's assert functions |
| 99 | + fail(actual: any, expected: any, message: string, operator: string): void; |
| 100 | + assert(value: any, message: string): void; |
| 101 | + ok(value: any, message?: string): void; |
| 102 | + equal(actual: any, expected: any, message?: string): void; |
| 103 | + notEqual(actual: any, expected: any, message?: string): void; |
| 104 | + deepEqual(actual: any, expected: any, message?: string): void; |
| 105 | + notDeepEqual(actual: any, expected: any, message?: string): void; |
| 106 | + strictEqual(actual: any, expected: any, message?: string): void; |
| 107 | + notStrictEqual(actual: any, expected: any, message?: string): void; |
| 108 | + throws(block: any, error?: any, message?: string): void; |
| 109 | + doesNotThrow(block: any, message?: string): void; |
| 110 | + ifError(value: any): void; |
| 111 | + inspect(value: any, obj: any): any; |
| 112 | +} |
| 113 | + |
| 114 | +declare var should: Internal; |
| 115 | + |
| 116 | +declare module "should" { |
| 117 | + export = should; |
| 118 | +} |
0 commit comments