| 159 | } |
| 160 | |
| 161 | class FakeServer implements HandoffHttpServer { |
| 162 | handler: (req: HandoffHttpRequest, res: HandoffHttpResponse) => void; |
| 163 | errorCb: ((err: NodeJS.ErrnoException) => void) | null = null; |
| 164 | closed = false; |
| 165 | listening = false; |
| 166 | constructor(handler: (req: HandoffHttpRequest, res: HandoffHttpResponse) => void) { |
| 167 | this.handler = handler; |
| 168 | } |
| 169 | listen(_port: number, _host: string, cb: () => void) { |
| 170 | this.listening = true; |
| 171 | cb(); |
| 172 | } |
| 173 | on(_event: 'error', cb: (err: NodeJS.ErrnoException) => void) { |
| 174 | this.errorCb = cb; |
| 175 | } |
| 176 | address() { |
| 177 | return { port: 52431 }; |
| 178 | } |
| 179 | close() { |
| 180 | this.closed = true; |
| 181 | } |
| 182 | request(url: string): FakeResponse { |
| 183 | const res = new FakeResponse(); |
| 184 | this.handler({ url }, res); |
| 185 | return res; |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | function harness(over: Partial<FirstRunHandshakeDeps> = {}) { |
| 190 | const outcomes: HandoffOutcome[] = []; |
nothing calls this directly
no outgoing calls
no test coverage detected