mirror of
https://github.com/denoland/deno.git
synced 2024-12-11 18:17:48 -05:00
f184332c09
* Prepend underscores to private modules * Remove collectUint8Arrays() It would be a misuse of Deno.iter()'s result. * Move std/_util/async.ts to std/async * Move std/util/sha*.ts to std/hash
25 lines
562 B
TypeScript
25 lines
562 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,
|
|
closeWrite: (): void => {},
|
|
read: (): Promise<number | null> => {
|
|
return Promise.resolve(0);
|
|
},
|
|
write: (): Promise<number> => {
|
|
return Promise.resolve(-1);
|
|
},
|
|
close: (): void => {},
|
|
...base,
|
|
};
|
|
}
|