mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-11 17:52:31 +03:00
fix(combo): restore missing preferAntigravityConnectionsWithStoredProject
quotaStrategies imported the reset-aware pool filter from ../antigravityProjectPersistence.ts, a module that does not exist — the helper belongs in antigravityProjectPersist.ts and was never added there, breaking typecheck. Add the helper alongside the persist path, point the import at the real module, and cover the filter with unit tests.
This commit is contained in:
committed by
diegosouzapw
parent
0c0ff26450
commit
bb07a8e5ff
32
tests/unit/antigravity-project-persist-pool-filter.test.ts
Normal file
32
tests/unit/antigravity-project-persist-pool-filter.test.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { preferAntigravityConnectionsWithStoredProject } from "@omniroute/open-sse/services/antigravityProjectPersist.ts";
|
||||
|
||||
test("keeps connections with a projectId on the column or in providerSpecificData", () => {
|
||||
const kept = preferAntigravityConnectionsWithStoredProject([
|
||||
{ id: "a", projectId: "projects/a" },
|
||||
{ id: "b", providerSpecificData: { projectId: "projects/b" } },
|
||||
]);
|
||||
|
||||
assert.deepEqual(
|
||||
kept.map((c) => c.id),
|
||||
["a", "b"]
|
||||
);
|
||||
});
|
||||
|
||||
test("drops connections whose projectId is missing, blank or not a string", () => {
|
||||
const kept = preferAntigravityConnectionsWithStoredProject([
|
||||
{ id: "missing" },
|
||||
{ id: "blank", projectId: " " },
|
||||
{ id: "null", projectId: null },
|
||||
{ id: "numeric", projectId: 42 },
|
||||
{ id: "blank-psd", providerSpecificData: { projectId: "" } },
|
||||
{ id: "null-psd", providerSpecificData: null },
|
||||
]);
|
||||
|
||||
assert.deepEqual(kept, []);
|
||||
});
|
||||
|
||||
test("returns an empty pool for an empty input instead of throwing", () => {
|
||||
assert.deepEqual(preferAntigravityConnectionsWithStoredProject([]), []);
|
||||
});
|
||||
Reference in New Issue
Block a user