mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-14 02:42:24 +03:00
fix(ci): clear the ESLint base-red on release/v3.8.51 — untyped casts in the volcengine upsert test
The tip has been NOT release-green since #12950 landed: its new unit test casts the module's `__testing` export to `any` three times, and `@typescript-eslint/no-explicit-any` is an error under `tests/` (#6218). `__testing` already exposes a fully typed `upsertConnection`, so the casts are dropped; the test keeps passing (3/3) and `npm run lint` on the tip goes from 3 errors to 0. Refs #12732
This commit is contained in:
@@ -0,0 +1 @@
|
||||
- Clear the `release/v3.8.51` base-red reported by #12732: drop the three `as any` casts in `tests/unit/volcengine-plan-binding-upsert.test.ts` (`__testing` already exports a typed `upsertConnection`), which tripped `no-explicit-any` (an error in `tests/`) on the tip.
|
||||
@@ -4,11 +4,11 @@ import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import os from "node:os";
|
||||
import { resetDbInstance } from "../../src/lib/db/core.ts";
|
||||
import { createProviderConnection, getProviderConnectionById } from "../../src/models/index.ts";
|
||||
import {
|
||||
createProviderConnection,
|
||||
getProviderConnectionById,
|
||||
} from "../../src/models/index.ts";
|
||||
import { detectPlan, __testing as bindingTesting } from "../../src/lib/providers/volcenginePlanBinding.ts";
|
||||
detectPlan,
|
||||
__testing as bindingTesting,
|
||||
} from "../../src/lib/providers/volcenginePlanBinding.ts";
|
||||
|
||||
test("detectPlan returns available: false when account has no active quota windows (unsubscribed)", async (t) => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
@@ -67,7 +67,7 @@ test("volcenginePlanBinding upsert rules with SQLite temp isolation", async (t)
|
||||
providerSpecificData: { autoFetchModels: true, customTag: "keep-me" },
|
||||
});
|
||||
|
||||
const updated1 = await (bindingTesting as any).upsertConnection(
|
||||
const updated1 = await bindingTesting.upsertConnection(
|
||||
"coding",
|
||||
"ark-new-key-1",
|
||||
"new-cookie-1",
|
||||
@@ -80,8 +80,16 @@ test("volcenginePlanBinding upsert rules with SQLite temp isolation", async (t)
|
||||
assert.equal(updated1.id, conn1.id);
|
||||
assert.equal(updated1.name, "main", "Preserves original custom name 'main'");
|
||||
assert.equal(updated1.apiKey, "ark-new-key-1");
|
||||
assert.equal(updated1.providerSpecificData.autoFetchModels, true, "Preserves existing PSD autoFetchModels");
|
||||
assert.equal(updated1.providerSpecificData.customTag, "keep-me", "Preserves existing PSD customTag");
|
||||
assert.equal(
|
||||
updated1.providerSpecificData.autoFetchModels,
|
||||
true,
|
||||
"Preserves existing PSD autoFetchModels"
|
||||
);
|
||||
assert.equal(
|
||||
updated1.providerSpecificData.customTag,
|
||||
"keep-me",
|
||||
"Preserves existing PSD customTag"
|
||||
);
|
||||
assert.equal(updated1.providerSpecificData.volcConsoleCookie, "new-cookie-1");
|
||||
assert.equal(updated1.providerSpecificData.volcApiKeyId, 123);
|
||||
|
||||
@@ -93,7 +101,7 @@ test("volcenginePlanBinding upsert rules with SQLite temp isolation", async (t)
|
||||
providerSpecificData: {},
|
||||
});
|
||||
|
||||
const createdNew = await (bindingTesting as any).upsertConnection(
|
||||
const createdNew = await bindingTesting.upsertConnection(
|
||||
"coding",
|
||||
"ark-brand-new-key-3",
|
||||
"new-cookie-3",
|
||||
@@ -117,7 +125,7 @@ test("volcenginePlanBinding upsert rules with SQLite temp isolation", async (t)
|
||||
});
|
||||
|
||||
// Passing conn1.id (which is coding-plan) into agent upsert must NOT match conn1
|
||||
const agentUpsertResult = await (bindingTesting as any).upsertConnection(
|
||||
const agentUpsertResult = await bindingTesting.upsertConnection(
|
||||
"agent",
|
||||
"ark-agent-new-key",
|
||||
"agent-cookie",
|
||||
@@ -168,7 +176,8 @@ test("findTargetConnection pure matching logic and single-connection adoption in
|
||||
{ id: "c2", provider: "volcengine-coding-plan", providerSpecificData: { volcApiKeyId: 888 } },
|
||||
];
|
||||
assert.equal(
|
||||
bindingTesting.findTargetConnection(list3, { ...criteria, apiKey: undefined, apiKeyId: 888 })?.id,
|
||||
bindingTesting.findTargetConnection(list3, { ...criteria, apiKey: undefined, apiKeyId: 888 })
|
||||
?.id,
|
||||
"c2"
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user