Public: anyone can read this; the crew can change it.
A pull that touches the app page shows that page beside main at 1440 and 390 #9804
Check · Review · Land · Live done — Landed and live in production.
mason/forge:mason/9797-a-pull-that-touches-the-app-page-shows-t → main 1 commit fork
3 files
changed +29
−2
src/web/studio/previews.ts +1 −1
| @@ -63,7 +63,7 @@ function openAppBtn(base: string, env: EnvStatus | undefined, forge = false): Ht | ||
| 63 | 63 | }); |
| 64 | 64 | const reason = |
| 65 | 65 | env === undefined || env.state === "stopped" |
| 66 | ? "Not running" | |
| 66 | ? "Nothing is running yet. The app starts when it is deployed." | |
| 67 | 67 | : env.state === "deploying" |
| 68 | 68 | ? "Still deploying" |
| 69 | 69 | : "The last deploy failed"; |
test/preview-app-look.test.ts +27
| @@ -5,7 +5,11 @@ import { tmpdir } from "node:os"; | ||
| 5 | 5 | import { join } from "node:path"; |
| 6 | 6 | import { createApp, type App } from "../src/app.ts"; |
| 7 | 7 | import { getAppByRepo } from "../src/core/apps.ts"; |
| 8 | import { getUserByName } from "../src/core/users.ts"; | |
| 9 | import type { Ctx } from "../src/http/context.ts"; | |
| 10 | import { studioApp } from "../src/web/studio/app.ts"; | |
| 8 | 11 | import { getRepo } from "../src/core/repos.ts"; |
| 12 | import { ownerLooksFor } from "../src/spawn/preview-looks.ts"; | |
| 9 | 13 | import { PREVIEW_ADMIN, PREVIEW_APP, PREVIEW_APP_PAGE, PREVIEW_OWNER_LOOKS, seedPreview } from "../src/spawn/preview-seed.ts"; |
| 10 | 14 | |
| 11 | 15 | let dir: string; |
| @@ -32,3 +36,26 @@ test("the seed made one app, as a record only", () => { | ||
| 32 | 36 | expect(getAppByRepo(app.db, repo.id)?.slug).toBe(PREVIEW_APP); |
| 33 | 37 | expect(app.db.query<{ n: number }, []>("SELECT count(*) AS n FROM app").get()!.n).toBe(1); |
| 34 | 38 | }); |
| 39 | ||
| 40 | test("a forge preview takes the app's page at both widths, whatever its diff touches (#9797)", () => { | |
| 41 | const looks = ownerLooksFor("trevato/forge", { ownerName: "trevato", name: "forge" }, "pull-1"); | |
| 42 | for (const kind of ["desktop", "phone"] as const) | |
| 43 | expect(looks).toContainEqual({ page: PREVIEW_APP_PAGE, kind }); | |
| 44 | // Another repository's preview, and production, take none of them. | |
| 45 | expect(ownerLooksFor("trevato/forge", { ownerName: "x", name: "y" }, "pull-1")).toEqual([]); | |
| 46 | expect(ownerLooksFor("trevato/forge", { ownerName: "trevato", name: "forge" }, "production")).toEqual([]); | |
| 47 | }); | |
| 48 | ||
| 49 | test("the app's page says in plain words why Open the app is off when nothing runs (#9797)", async () => { | |
| 50 | const repo = getRepo(app.db, PREVIEW_ADMIN, PREVIEW_APP)!; | |
| 51 | const record = getAppByRepo(app.db, repo.id)!; | |
| 52 | const admin = getUserByName(app.db, PREVIEW_ADMIN)!; | |
| 53 | const url = new URL(`https://preview.invalid${PREVIEW_APP_PAGE}`); | |
| 54 | const answer = await studioApp( | |
| 55 | { app, request: new Request(url.href), url, params: {}, auth: { user: admin }, theme: undefined } as Ctx, | |
| 56 | repo, | |
| 57 | record, | |
| 58 | ); | |
| 59 | expect(answer.status).toBe(200); | |
| 60 | expect(await answer.text()).toContain('title="Nothing is running yet. The app starts when it is deployed."'); | |
| 61 | }); |
test/studio-door.test.ts +1 −1
| @@ -780,7 +780,7 @@ describe("the studio head says why the app is not up", () => { | ||
| 780 | 780 | expect(mine).toContain('action="/alice/notes/app/production/redeploy"'); |
| 781 | 781 | expect(mine).not.toContain('href="/-/confirm?to=%2Falice%2Fnotes%2Fapp%2Fproduction%2Fstop"'); |
| 782 | 782 | expect(mine).not.toContain('href="/alice/notes/app/production/open"'); |
| 783 | expect(mine).toContain('title="Not running"'); | |
| 783 | expect(mine).toContain('title="Nothing is running yet. The app starts when it is deployed."'); | |
| 784 | 784 | expect(await shelfBadge(writer)).toBe("not running"); |
| 785 | 785 | }); |
| 786 | 786 |