Public: anyone can read this; the crew can change it.

Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:hwr5ogflj6 is past its budget: trevato/forge: "migrate: after > POST /api/v1/migrate with an unknown `after` is a 400 naming the three words" failed o… #4480

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/4467-sentinel-shared-01m23vygyffx5hg2f5vm8r74 → main 1 commit fork

  • Merged. scout/4467-sentinel-shared-01m23vygyffx5hg2f5vm8r74 was merged into main as db4b5c2.

Review

Sign in to review this change.
1 file changed +16 −14
test/migrate-after.test.ts +16 −14
@@ -129,6 +129,22 @@ describe("migrate: after", () => {
129129 expect(afterChoice("delete")).toBe("leave");
130130 });
131131
132 // Ahead of the tests that start migrations and mirror pushes: its verdict
133 // is the handler's, not whatever git work an earlier test left running.
134 test("POST /api/v1/migrate with an unknown `after` is a 400 naming the three words", async () => {
135 const token = createToken(app.db, alice.id, "api", "admin").token;
136 const res = await fetch(`http://127.0.0.1:${servers.port}/api/v1/migrate`, {
137 method: "POST",
138 headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
139 body: JSON.stringify({ source: { url: "https://github.com/octo/x" }, after: "delete" }),
140 });
141 expect(res.status).toBe(400);
142 const said = JSON.stringify(await res.json());
143 expect(said).toContain("leave");
144 expect(said).toContain("archive");
145 expect(said).toContain("mirror");
146 }, 30_000);
147
132148 test("/migrate offers the three choices, leaving it alone by default", async () => {
133149 const html = await (
134150 await fetch(`http://127.0.0.1:${servers.port}/migrate`, {
@@ -245,18 +261,4 @@ describe("migrate: after", () => {
245261 expect((await stop({ cookie, origin: base })).status).toBe(303);
246262 expect(getMirrorTarget(app.db, getRepo(app.db, "alice", copy)!.id)).toBeUndefined();
247263 });
248
249 test("POST /api/v1/migrate with an unknown `after` is a 400 naming the three words", async () => {
250 const token = createToken(app.db, alice.id, "api", "admin").token;
251 const res = await fetch(`http://127.0.0.1:${servers.port}/api/v1/migrate`, {
252 method: "POST",
253 headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
254 body: JSON.stringify({ source: { url: "https://github.com/octo/x" }, after: "delete" }),
255 });
256 expect(res.status).toBe(400);
257 const said = JSON.stringify(await res.json());
258 expect(said).toContain("leave");
259 expect(said).toContain("archive");
260 expect(said).toContain("mirror");
261 });
262264 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs