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
66
67
68
69
70
71
72
|
import { Socket } from "net";
import { expectAssignable } from "tsd";
import { DiagnosticsChannel, buildConnector } from "../..";
const request = {
origin: "",
completed: true,
method: "GET" as const,
path: "",
headers: "",
addHeader: (key: string, value: string) => {
return request;
},
};
const response = {
statusCode: 200,
statusText: "OK",
headers: [Buffer.from(""), Buffer.from("")],
};
const connectParams = {
host: "",
hostname: "",
protocol: "",
port: "",
servername: "",
};
expectAssignable<DiagnosticsChannel.RequestCreateMessage>({ request });
expectAssignable<DiagnosticsChannel.RequestBodySentMessage>({ request });
expectAssignable<DiagnosticsChannel.RequestHeadersMessage>({
request,
response,
});
expectAssignable<DiagnosticsChannel.RequestTrailersMessage>({
request,
trailers: [Buffer.from(""), Buffer.from("")],
});
expectAssignable<DiagnosticsChannel.RequestErrorMessage>({
request,
error: new Error("Error"),
});
expectAssignable<DiagnosticsChannel.ClientSendHeadersMessage>({
request,
headers: "",
socket: new Socket(),
});
expectAssignable<DiagnosticsChannel.ClientBeforeConnectMessage>({
connectParams,
connector: (
options: buildConnector.Options,
callback: buildConnector.Callback
) => new Socket(),
});
expectAssignable<DiagnosticsChannel.ClientConnectedMessage>({
socket: new Socket(),
connectParams,
connector: (
options: buildConnector.Options,
callback: buildConnector.Callback
) => new Socket(),
});
expectAssignable<DiagnosticsChannel.ClientConnectErrorMessage>({
error: new Error("Error"),
socket: new Socket(),
connectParams,
connector: (
options: buildConnector.Options,
callback: buildConnector.Callback
) => new Socket(),
});
|