Add coverage for dockhand token auth
Tests / vitest (4) (push) Has been cancelled
Docker CI / Docker Build & Push (push) Has been cancelled
Lint / Linting Checks (push) Has been cancelled
Release Drafter / Update Release Draft (push) Has been cancelled
Release Drafter / Auto Label PR (push) Has been cancelled
Tests / vitest (1) (push) Has been cancelled
Tests / vitest (2) (push) Has been cancelled
Tests / vitest (3) (push) Has been cancelled

This commit is contained in:
shamoon
2026-07-07 18:49:33 -07:00
parent c323b5b2e4
commit 059bdd2236
+23
View File
@@ -79,4 +79,27 @@ describe("widgets/dockhand/proxy", () => {
expect(res.body.error.message).toBe("HTTP Error");
expect(res.body.error.url).toContain("token=***");
});
it("supports token auth", async () => {
getServiceWidget.mockResolvedValue({
type: "dockhand",
url: "http://dockhand",
key: "abc",
});
httpProxy.mockResolvedValueOnce([200, "application/json", Buffer.from("ok")]);
const req = {
method: "GET",
query: { group: "g", service: "svc", endpoint: "api/v1/status", index: "0" },
};
const res = createMockRes();
await dockhandProxyHandler(req, res);
expect(httpProxy).toHaveBeenCalledWith(
new URL("http://dockhand/api/v1/status"),
expect.objectContaining({ method: "GET", headers: { Authorization: "Bearer abc" } }),
);
});
});