mirror of
https://github.com/gethomepage/homepage.git
synced 2026-09-21 11:35:49 -07:00
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
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:
@@ -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" } }),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user