This commit is contained in:
parent
d99c2d9894
commit
3173641827
3 changed files with 8 additions and 23 deletions
|
|
@ -39,6 +39,12 @@ describe("server", () => {
|
|||
expect(response.status).toBe(401);
|
||||
});
|
||||
|
||||
test("does not serve legacy git-webhooks routes", async () => {
|
||||
const handler = createHandler({ githubSecret: "gh", jojoSecret: "jojo", dataDir: await mkdtemp(join(tmpdir(), "patchbay-")) });
|
||||
const response = await handler(new Request("http://localhost/git-webhooks/jojo", { method: "POST", body: "{}" }));
|
||||
expect(response.status).toBe(404);
|
||||
});
|
||||
|
||||
test("accepts jojo main pushes and queues a job", async () => {
|
||||
const dataDir = await mkdtemp(join(tmpdir(), "patchbay-"));
|
||||
const handler = createHandler({ githubSecret: "gh", jojoSecret: "jojo", dataDir });
|
||||
|
|
@ -58,24 +64,6 @@ describe("server", () => {
|
|||
expect(await readFile(join(dataDir, "jobs.jsonl"), "utf8")).toContain("\"kind\":\"main_push\"");
|
||||
});
|
||||
|
||||
test("keeps legacy git-webhooks routes as aliases", async () => {
|
||||
const dataDir = await mkdtemp(join(tmpdir(), "patchbay-"));
|
||||
const handler = createHandler({ githubSecret: "gh", jojoSecret: "jojo", dataDir });
|
||||
const request = await signedRequest("/git-webhooks/jojo", "jojo", "jojo", {
|
||||
ref: "refs/heads/main",
|
||||
after: "abc123",
|
||||
repository: {
|
||||
name: "patchbay",
|
||||
full_name: "peezy-tech/patchbay",
|
||||
owner: { username: "peezy-tech" },
|
||||
},
|
||||
});
|
||||
|
||||
const response = await handler(request);
|
||||
expect(response.status).toBe(202);
|
||||
expect(await readFile(join(dataDir, "events.jsonl"), "utf8")).toContain("\"provider\":\"jojo\"");
|
||||
});
|
||||
|
||||
test("continues accepting webhooks when Discord returns an error", async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
globalThis.fetch = (async () => new Response("bad", { status: 500 })) as unknown as typeof fetch;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue