mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-21 22:52:19 +03:00
Merged — validated together with a batch of related RaviTharuma PRs in one combined worktree (typecheck:core clean, complexity/file-size/changelog gates green, focused tests passing). Thanks for the contribution!
25 lines
1.0 KiB
TypeScript
25 lines
1.0 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import {
|
|
resetEmptyAutoPoolWarnStateForTests,
|
|
warnEmptyAutoPoolOnce,
|
|
} from "../../open-sse/services/autoCombo/virtualFactory.ts";
|
|
|
|
test("warnEmptyAutoPoolOnce emits at most once per label per process", () => {
|
|
resetEmptyAutoPoolWarnStateForTests();
|
|
const t0 = 1_700_000_000_000;
|
|
assert.equal(warnEmptyAutoPoolOnce("auto/zai", "empty", t0), true);
|
|
assert.equal(warnEmptyAutoPoolOnce("auto/zai", "empty", t0 + 1), false);
|
|
assert.equal(warnEmptyAutoPoolOnce("auto/zai", "empty", t0 + 60_000), false);
|
|
assert.equal(warnEmptyAutoPoolOnce("auto/zai", "empty", t0 + 3_600_000), false);
|
|
assert.equal(warnEmptyAutoPoolOnce("auto/other", "empty", t0 + 1), true);
|
|
});
|
|
|
|
test("resetEmptyAutoPoolWarnStateForTests allows a later warn (emptiness reappeared)", () => {
|
|
resetEmptyAutoPoolWarnStateForTests();
|
|
assert.equal(warnEmptyAutoPoolOnce("auto/zai", "empty"), true);
|
|
resetEmptyAutoPoolWarnStateForTests();
|
|
assert.equal(warnEmptyAutoPoolOnce("auto/zai", "empty"), true);
|
|
});
|