mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 09:40:41 +00:00
test: tighten qa credential fetch assertion
This commit is contained in:
@@ -16,6 +16,15 @@ function jsonResponse(payload: unknown, status = 200) {
|
||||
});
|
||||
}
|
||||
|
||||
function requireFirstFetchInput(fetchImpl: ReturnType<typeof vi.fn>): RequestInfo | URL {
|
||||
const input = fetchImpl.mock.calls[0]?.[0] as RequestInfo | URL | undefined;
|
||||
expect(input).toBeDefined();
|
||||
if (!input) {
|
||||
throw new Error("expected fetch input");
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
describe("qa credential admin runtime", () => {
|
||||
it("adds a credential set through the admin endpoint", async () => {
|
||||
const fetchImpl = vi.fn(async (_input: RequestInfo | URL, _init?: RequestInit) =>
|
||||
@@ -112,7 +121,9 @@ describe("qa credential admin runtime", () => {
|
||||
fetchImpl,
|
||||
});
|
||||
|
||||
expect(fetchImpl.mock.calls[0]?.[0]).toBe("http://127.0.0.1:3210/qa-credentials/v1/admin/list");
|
||||
expect(requireFirstFetchInput(fetchImpl)).toBe(
|
||||
"http://127.0.0.1:3210/qa-credentials/v1/admin/list",
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects unsafe endpoint-prefix overrides", async () => {
|
||||
|
||||
Reference in New Issue
Block a user