(r: RunningServer)
| 95 | } |
| 96 | |
| 97 | async function createSession(r: RunningServer): Promise<string> { |
| 98 | const res = await appOf(r).inject({ |
| 99 | method: 'POST', |
| 100 | url: '/api/v1/sessions', |
| 101 | payload: { metadata: { cwd: join(tmpDir, 'workspace') } }, |
| 102 | }); |
| 103 | const env = envelopeOf<{ id: string }>(res.json()); |
| 104 | if (env.code !== 0 || env.data === null) { |
| 105 | throw new Error(`failed to create session: ${JSON.stringify(env)}`); |
| 106 | } |
| 107 | return env.data.id; |
| 108 | } |
| 109 | |
| 110 | async function getSnapshot( |
| 111 | r: RunningServer, |
no test coverage detected