Public: anyone can read this; the crew can change it.
The app page's not-running sentence is tested against the state production is really in #16273
talk/fix-web-apps-test → main 1 commit
1 file
changed +15
−1
test/web-apps.test.ts +15 −1
| @@ -27,6 +27,7 @@ import { tmpdir } from "node:os"; | ||
| 27 | 27 | import { join } from "node:path"; |
| 28 | 28 | import { createApp, type App } from "../src/app.ts"; |
| 29 | 29 | import { addToCrew, createAgent } from "../src/actions/crew.ts"; |
| 30 | import { appView } from "../src/actions/apps.ts"; | |
| 30 | 31 | import { openPull } from "../src/actions/pulls.ts"; |
| 31 | 32 | import { commitToBranch } from "../src/actions/repos.ts"; |
| 32 | 33 | import { AppsRuntime } from "../src/apps/runtime.ts"; |
| @@ -1094,7 +1095,20 @@ describe("apps, runs and the crew on the web", () => { | ||
| 1094 | 1095 | expect(old.status).toBe(302); |
| 1095 | 1096 | const page = words(await (await web(alice, `${old.headers.get("location")!}/files`)).text()); |
| 1096 | 1097 | const strip = page.slice(page.indexOf('class="app-strip"')); |
| 1097 | expect(strip).toContain("Not running. Deploy main to start it."); | |
| 1098 | // The sentence follows the state production is really in. A first deploy | |
| 1099 | // that started leaves it stopped; one that could not start on this | |
| 1100 | // machine leaves it failed, and stopping a failed production keeps that | |
| 1101 | // word. Either way it is not running, and the strip says what to do. | |
| 1102 | const view = appView(app, user("alice"), hello); | |
| 1103 | if (!view.ok) throw new Error(view.error); | |
| 1104 | const production = view.value.environments.find((env) => env.env === "production"); | |
| 1105 | const state = production?.state ?? "stopped"; | |
| 1106 | expect(["stopped", "failed"]).toContain(state); | |
| 1107 | expect(strip).toContain( | |
| 1108 | state === "failed" | |
| 1109 | ? "Failed to start. Deploy main to try again." | |
| 1110 | : "Not running. Deploy main to start it.", | |
| 1111 | ); | |
| 1098 | 1112 | } finally { |
| 1099 | 1113 | // Leave production as found, so test order does not matter. |
| 1100 | 1114 | await web(alice, "/alice/hello/app/production/redeploy", { form: {} }); |
new above
offline