Skip to content

Commit 2665fed

Browse files
committed
test(openrouter): preserve typed fetch arguments in proxy fixtures
1 parent 90ea596 commit 2665fed

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎extensions/openrouter/index.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ describe("openrouter provider hooks", () => {
329329

330330
it("forwards configured proxy destination and headers to both usage requests", async () => {
331331
const provider = await registerSingleProviderPlugin(openrouterPlugin);
332-
const fetchFn = vi.fn(async () => Response.json({ data: { usage: 1 } }));
332+
const fetchFn = vi.fn<typeof fetch>(async () => Response.json({ data: { usage: 1 } }));
333333

334334
await provider.fetchUsageSnapshot?.({
335335
config: {

‎extensions/openrouter/usage.test.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe("OpenRouter usage", () => {
5656
});
5757

5858
it("keeps custom provider credentials on the configured usage origin", async () => {
59-
const fetchFn = vi.fn(async () => Response.json({ data: { usage: 1 } }));
59+
const fetchFn = vi.fn<typeof fetch>(async () => Response.json({ data: { usage: 1 } }));
6060

6161
await fetchOpenRouterUsage({
6262
token: "synthetic-private-proxy-key",
@@ -77,7 +77,7 @@ describe("OpenRouter usage", () => {
7777
});
7878

7979
it("preserves configured request headers and custom auth for both proxy usage endpoints", async () => {
80-
const fetchFn = vi.fn(async () => Response.json({ data: { usage: 1 } }));
80+
const fetchFn = vi.fn<typeof fetch>(async () => Response.json({ data: { usage: 1 } }));
8181

8282
await fetchOpenRouterUsage({
8383
token: "synthetic-original-key",
@@ -123,7 +123,7 @@ describe("OpenRouter usage", () => {
123123
});
124124

125125
it("preserves explicitly allowed private-origin usage requests", async () => {
126-
const fetchFn = vi.fn(async () => Response.json({ data: { usage: 1 } }));
126+
const fetchFn = vi.fn<typeof fetch>(async () => Response.json({ data: { usage: 1 } }));
127127

128128
await fetchOpenRouterUsage({
129129
token: "synthetic-private-key",
@@ -140,7 +140,7 @@ describe("OpenRouter usage", () => {
140140
});
141141

142142
it("trusts only the operator-configured private origin when no deny policy is set", async () => {
143-
const fetchFn = vi.fn(async () => Response.json({ data: { usage: 1 } }));
143+
const fetchFn = vi.fn<typeof fetch>(async () => Response.json({ data: { usage: 1 } }));
144144

145145
await fetchOpenRouterUsage({
146146
token: "synthetic-private-key",
@@ -234,7 +234,7 @@ describe("OpenRouter usage", () => {
234234
);
235235

236236
it("surfaces blocked usage redirects without replaying private credentials", async () => {
237-
const fetchFn = vi.fn(
237+
const fetchFn = vi.fn<typeof fetch>(
238238
async () =>
239239
new Response(null, {
240240
status: 302,

0 commit comments

Comments
 (0)