mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 21:07:01 -06:00
test: tighten gateway live assertions
This commit is contained in:
@@ -461,11 +461,13 @@ describeLive("gateway live (cli backend)", () => {
|
||||
} else {
|
||||
expect(text).toContain(`CLI-BACKEND-${nonce}`);
|
||||
}
|
||||
expect(
|
||||
const injectedFileNames =
|
||||
resultWithMeta.meta?.systemPromptReport?.injectedWorkspaceFiles?.map(
|
||||
(entry) => entry.name,
|
||||
) ?? [],
|
||||
).toEqual(expect.arrayContaining(bootstrapWorkspace?.expectedInjectedFiles ?? []));
|
||||
) ?? [];
|
||||
for (const expectedFile of bootstrapWorkspace?.expectedInjectedFiles ?? []) {
|
||||
expect(injectedFileNames).toContain(expectedFile);
|
||||
}
|
||||
}
|
||||
|
||||
if (modelSwitchTarget) {
|
||||
|
||||
@@ -1358,10 +1358,8 @@ describe("sanitizeAuthProfileStoreForLiveGateway", () => {
|
||||
try {
|
||||
const sanitized = sanitizeAuthProfileStoreForLiveGateway(store);
|
||||
expect(sanitized.profiles.openaiProfile).toBeUndefined();
|
||||
expect(sanitized.profiles.codexProfile).toMatchObject({
|
||||
type: "oauth",
|
||||
provider: "openai-codex",
|
||||
});
|
||||
expect(sanitized.profiles.codexProfile?.type).toBe("oauth");
|
||||
expect(sanitized.profiles.codexProfile?.provider).toBe("openai-codex");
|
||||
expect(sanitized.order).toEqual({ "openai-codex": ["codexProfile"] });
|
||||
expect(sanitized.lastGood).toEqual({ "openai-codex": "codexProfile" });
|
||||
expect(sanitized.usageStats).toEqual({ codexProfile: { lastUsed: 2 } });
|
||||
|
||||
@@ -152,10 +152,8 @@ async function approveTrajectoryExport(client: GatewayClient): Promise<string> {
|
||||
const approval = approvals.find((entry) =>
|
||||
entry.request?.command?.includes("sessions export-trajectory"),
|
||||
);
|
||||
expect(approval).toMatchObject({
|
||||
id: expect.any(String),
|
||||
request: { command: expect.stringContaining("sessions export-trajectory") },
|
||||
});
|
||||
expect(typeof approval?.id).toBe("string");
|
||||
expect(approval?.request?.command).toContain("sessions export-trajectory");
|
||||
if (!approval?.id) {
|
||||
throw new Error("expected trajectory export approval id");
|
||||
}
|
||||
@@ -285,17 +283,18 @@ describeLive("gateway live trajectory export", () => {
|
||||
if (finalText) {
|
||||
expect(finalText).toContain("Approve once");
|
||||
}
|
||||
expect(await listDirectoryNames(bundleDir)).toEqual(
|
||||
expect.arrayContaining([
|
||||
"artifacts.json",
|
||||
"events.jsonl",
|
||||
"manifest.json",
|
||||
"metadata.json",
|
||||
"prompts.json",
|
||||
"session.jsonl",
|
||||
"tools.json",
|
||||
]),
|
||||
);
|
||||
const bundleNames = await listDirectoryNames(bundleDir);
|
||||
for (const expectedName of [
|
||||
"artifacts.json",
|
||||
"events.jsonl",
|
||||
"manifest.json",
|
||||
"metadata.json",
|
||||
"prompts.json",
|
||||
"session.jsonl",
|
||||
"tools.json",
|
||||
]) {
|
||||
expect(bundleNames).toContain(expectedName);
|
||||
}
|
||||
expect(beforeExport.has("bundle")).toBe(false);
|
||||
|
||||
const manifest = JSON.parse(
|
||||
|
||||
@@ -107,9 +107,7 @@ function expectPluginApprovalId(value: unknown, label: string): string {
|
||||
expect(uuid).toHaveLength(36);
|
||||
expect(uuid.split("-").map((part) => part.length)).toEqual([8, 4, 4, 4, 12]);
|
||||
expect(
|
||||
uuid
|
||||
.split("-")
|
||||
.every((part) => part.length > 0 && [...part].every((char) => /[0-9a-f]/.test(char))),
|
||||
uuid.split("-").every((part) => /^[0-9a-f]+$/.test(part)),
|
||||
label,
|
||||
).toBe(true);
|
||||
return value;
|
||||
|
||||
Reference in New Issue
Block a user