File
Blob: scripts/litmus/fixture.ts
| 1 | interface LitmusFixture { |
| 2 | url: string; |
| 3 | username: string; |
| 4 | pat: string; |
| 5 | } |
| 6 | |
| 7 | async function main(): Promise<void> { |
| 8 | const baseUrl = process.env.DAB_LITMUS_BASE_URL ?? `http://dab.localhost:${process.env.DAB_LITMUS_PORT ?? "8787"}`; |
| 9 | const response = await fetch(new URL("/__dab_test/fixtures/litmus", baseUrl), { method: "POST" }); |
| 10 | if (response.status !== 200) { |
| 11 | throw new Error(`fixture route returned ${response.status}: ${await response.text()}`); |
| 12 | } |
| 13 | const fixture = (await response.json()) as Partial<LitmusFixture>; |
| 14 | if (!fixture.url || !fixture.username || !fixture.pat) { |
| 15 | throw new Error(`fixture route returned invalid payload: ${JSON.stringify(fixture)}`); |
| 16 | } |
| 17 | |
| 18 | console.log(`LITMUS_URL=${fixture.url}`); |
| 19 | console.log(`LITMUS_USERNAME=${fixture.username}`); |
| 20 | console.log(`LITMUS_PAT=${fixture.pat}`); |
| 21 | } |
| 22 | |
| 23 | main().catch((error) => { |
| 24 | console.error(error instanceof Error ? error.message : String(error)); |
| 25 | process.exit(1); |
| 26 | }); |