test(core): remove orphan test exports (#122500)

This commit is contained in:
Peter Steinberger
2026-08-12 00:04:39 -07:00
committed by GitHub
parent 07d9f9c92c
commit d3696f8d76
4 changed files with 11 additions and 13 deletions
-2
View File
@@ -641,8 +641,6 @@ async function resolveImagesForRequest(
}
export const testOnlyOpenAiHttp = {
resolveImagesForRequest,
resolveOpenAiChatCompletionsLimits,
resolveChatCompletionUsage,
};
@@ -188,8 +188,13 @@ function expectSuccessfulSessionsUsage(
return result.sessions;
}
function mockStoredSession(key: string, sessionId: string) {
function mockStoredSession(
key: string,
sessionId: string,
options: { resolution?: "valid" | "missing" } = {},
) {
const entry = { sessionId, updatedAt: 1_000 };
const storePath = "/tmp/agents/opus/agent/openclaw-agent.sqlite";
vi.mocked(loadGatewaySessionEntryReadOnly).mockReturnValueOnce({
cfg: TEST_RUNTIME_CONFIG,
canonicalKey: key,
@@ -197,8 +202,11 @@ function mockStoredSession(key: string, sessionId: string) {
legacyKey: undefined,
store: { [key]: entry },
storeKeys: [key],
storePath: "/tmp/agents/opus/sessions/sessions.json",
storePath,
});
vi.mocked(resolveExistingUsageSessionFile).mockReturnValueOnce(
options.resolution === "missing" ? undefined : `sqlite:opus:${sessionId}:${storePath}`,
);
return entry;
}
@@ -852,8 +860,7 @@ describe("sessions.usage", () => {
it("fails closed when a canonical stored target no longer matches", async () => {
const key = "agent:opus:stale";
mockStoredSession(key, "stale");
vi.mocked(resolveExistingUsageSessionFile).mockReturnValueOnce(undefined);
mockStoredSession(key, "stale", { resolution: "missing" });
const respond = await runSessionsUsageTimeseries({ key });
expect(mockArg(respond, 0, 0)).toBe(false);
expect(vi.mocked(loadSessionUsageTimeSeries)).not.toHaveBeenCalled();
-5
View File
@@ -1130,18 +1130,13 @@ function mergeUsageCacheStatus(
// Exposed for unit tests (kept as a single export to avoid widening the public API surface).
export const testApi = {
parseDateParts,
parseUtcOffsetToMinutes,
resolveDateInterpretation,
parseDateToMs,
parseDays,
resolveDateRange,
discoverAllSessionsForUsage,
loadCostUsageSummaryCached,
costUsageCache,
loadSessionsUsageResultCached,
sessionsUsageCache,
sessionsUsageCacheKey,
};
export type { SessionUsageEntry, SessionsUsageAggregates, SessionsUsageResult };
-2
View File
@@ -6,8 +6,6 @@ import {
type TranscriptEvent,
} from "../config/sessions/session-accessor.js";
export type SqliteSessionTranscriptEventForTest = TranscriptEvent;
/** Appends a raw SQLite transcript event for first-party tests only. */
export async function appendSqliteSessionTranscriptEventForTest(
params: SessionTranscriptAccessScope & { event: TranscriptEvent },