Skip to content

Commit 6bca11e

Browse files
committed
Added definition for nock module
1 parent 03ebb37 commit 6bca11e

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

nock.d.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
declare module "nock" {
2+
export import nock = module('nock');
3+
4+
export function(host: string, options?: Options): Scope;
5+
export var recorder: Recorder;
6+
7+
declare class Scope {
8+
get(path: string, data?: string): Scope;
9+
post(path: string, data?: string): Scope;
10+
put(path: string, data?: string): Scope;
11+
head(path: string): Scope;
12+
delete(path: string, data?: string): Scope;
13+
intercept(path: string, verb: string, body?: string, options?: any);
14+
15+
reply(responseCode: number, body?: string, headers?: any): Scope;
16+
reply(responseCode: number, callback: (uri: string, body:string) => string, headers?: any): Scope;
17+
replyWithFile(responseCode: number, fileName: string): Scope;
18+
19+
defaultReplyHeaders(headers: any);
20+
matchHeader(name: string, value: string);
21+
22+
filteringPath(regex: RegExp, replace: string): Scope;
23+
filteringPath(fn: (path:string) => string): Scope;
24+
filteringRequestBody(regex: RegExp, replace: string): Scope;
25+
filteringRequestBody(fn: (path:string) => string): Scope;
26+
27+
persist(): Scope;
28+
log(out: () => void): Scope;
29+
30+
done(): void;
31+
isDone(): bool;
32+
cleanAll(): void;
33+
restore(): void;
34+
}
35+
36+
declare class Recorder {
37+
rec(capture?: bool): void;
38+
play(): string[];
39+
}
40+
41+
interface Options {
42+
allowUnmocked?: bool;
43+
}
44+
}

0 commit comments

Comments
 (0)