-
Notifications
You must be signed in to change notification settings - Fork 112
/
Copy pathindex.d.ts
65 lines (48 loc) · 1.83 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Definitions by: Wim Looman <https://github.com/Nemo157>
// Liam Jones <https://github.com/G1itcher>
// Federico Caselli <https://github.com/CaselIT>
// Bas Luksenburg <https://github.com/bas-l>
// Austin Cawley-Edwards <https://github.com/austince>
// TypeScript Version: 3.0
/// <reference types="chai" />
import * as request from 'superagent';
// Merge namespace with global chai
declare global {
namespace Chai {
interface ChaiStatic {
request: ChaiHttpRequest;
}
interface ChaiHttpRequest {
(server: any): ChaiHttp.Agent;
agent(server: any): ChaiHttp.Agent;
addPromises(promiseConstructor: PromiseConstructorLike): void;
}
interface Assertion {
redirectTo(location: string|RegExp): Assertion;
param(key: string, value?: string): Assertion;
cookie(key: string, value?: string, attributes?: Object): Assertion;
attribute(attr: string, expected?: string|boolean): Assertion;
status(code: number): Assertion;
statusCode(code: number): Assertion;
header(key: string, value?: string | RegExp): Assertion;
charset(charset: string): Assertion;
headers: Assertion;
json: Assertion;
text: Assertion;
html: Assertion;
redirect: Assertion;
}
interface TypeComparison {
ip: Assertion;
}
}
namespace ChaiHttp {
interface Response extends request.Response {}
interface Agent extends request.SuperAgentStatic {
keepOpen(): Agent;
close(callback?: (err: any) => void): Agent;
}
}
}
declare function chaiHttp(chai: any, utils: any): void;
export = chaiHttp;