mirror of
https://github.com/denoland/deno.git
synced 2024-12-01 16:51:13 -05:00
c8fc29fcca
readRequest should not write a response.
This reverts commit 017a611131
.
26 lines
597 B
TypeScript
26 lines
597 B
TypeScript
/** Create dummy Deno.Conn object with given base properties */
|
|
export function mockConn(base: Partial<Deno.Conn> = {}): Deno.Conn {
|
|
return {
|
|
localAddr: {
|
|
transport: "tcp",
|
|
hostname: "",
|
|
port: 0,
|
|
},
|
|
remoteAddr: {
|
|
transport: "tcp",
|
|
hostname: "",
|
|
port: 0,
|
|
},
|
|
rid: -1,
|
|
closeRead: (): void => {},
|
|
closeWrite: (): void => {},
|
|
read: (): Promise<number | Deno.EOF> => {
|
|
return Promise.resolve(0);
|
|
},
|
|
write: (): Promise<number> => {
|
|
return Promise.resolve(-1);
|
|
},
|
|
close: (): void => {},
|
|
...base,
|
|
};
|
|
}
|