mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-21 22:52:19 +03:00
Merged — locally validated (30/30 focused tests: chatcore-codex-account-pool, codex-account-cooldown-write, codex-account-pool, providers-route-codex-account-pool, resilience-explain-codex-account, sse-auth-codex-account-pool; typecheck:core clean; file-size/complexity/cognitive-complexity/changelog gates all green). Merges clean against the current release tip with zero conflicts. Great refactor — extracting persistCodexQuotaState out of chatCore.ts into a proper codexAccount/ module with virtual quota pool isolation is a solid improvement. Thanks!
37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import { fileURLToPath } from "node:url";
|
|
import { dirname, join } from "node:path";
|
|
|
|
// Split-guard for the codex executor quota extraction.
|
|
// The pure quota-snapshot parsing + reset/cooldown scheduling lives in codex/quota.ts.
|
|
// Host re-exports the 4 public symbols for the Codex account module and tests.
|
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
const EXE = join(HERE, "../../open-sse/executors");
|
|
const HOST = join(EXE, "codex.ts");
|
|
const LEAF = join(EXE, "codex/quota.ts");
|
|
|
|
test("leaf hosts the quota helpers and does not import the host", () => {
|
|
const src = readFileSync(LEAF, "utf8");
|
|
for (const sym of [
|
|
"parseCodexQuotaHeaders",
|
|
"getCodexResetTime",
|
|
"getCodexDualWindowCooldownMs",
|
|
"CodexQuotaSnapshot",
|
|
]) {
|
|
assert.match(src, new RegExp(`export (function|interface) ${sym}\\b`));
|
|
}
|
|
assert.doesNotMatch(src, /from "\.\.\/codex\.ts"/);
|
|
});
|
|
|
|
test("host re-exports the quota symbols for external importers", () => {
|
|
const host = readFileSync(HOST, "utf8");
|
|
assert.match(host, /from "\.\/codex\/quota\.ts"/);
|
|
});
|
|
|
|
test("parseCodexQuotaHeaders returns null without quota headers", async () => {
|
|
const { parseCodexQuotaHeaders } = await import("../../open-sse/executors/codex/quota.ts");
|
|
assert.equal(parseCodexQuotaHeaders({}), null);
|
|
});
|