mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 15:08:25 +00:00
fix(test): repair readonly case table typing
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js";
|
||||
import { typedCases } from "../test-utils/typed-cases.js";
|
||||
import { buildSubagentSystemPrompt } from "./subagent-announce.js";
|
||||
import { buildAgentSystemPrompt, buildRuntimeLine } from "./system-prompt.js";
|
||||
|
||||
describe("buildAgentSystemPrompt", () => {
|
||||
it("formats owner section for plain, hash, and missing owner lists", () => {
|
||||
const cases = [
|
||||
const cases = typedCases<{
|
||||
name: string;
|
||||
params: Parameters<typeof buildAgentSystemPrompt>[0];
|
||||
expectAuthorizedSection: boolean;
|
||||
contains: string[];
|
||||
notContains: string[];
|
||||
hashMatch?: RegExp;
|
||||
}>([
|
||||
{
|
||||
name: "plain owner numbers",
|
||||
params: {
|
||||
@@ -16,14 +24,14 @@ describe("buildAgentSystemPrompt", () => {
|
||||
contains: [
|
||||
"Authorized senders: +123, +456. These senders are allowlisted; do not assume they are the owner.",
|
||||
],
|
||||
notContains: [] as string[],
|
||||
notContains: [],
|
||||
},
|
||||
{
|
||||
name: "hashed owner numbers",
|
||||
params: {
|
||||
workspaceDir: "/tmp/openclaw",
|
||||
ownerNumbers: ["+123", "+456", ""],
|
||||
ownerDisplay: "hash" as const,
|
||||
ownerDisplay: "hash",
|
||||
},
|
||||
expectAuthorizedSection: true,
|
||||
contains: ["Authorized senders:"],
|
||||
@@ -36,10 +44,10 @@ describe("buildAgentSystemPrompt", () => {
|
||||
workspaceDir: "/tmp/openclaw",
|
||||
},
|
||||
expectAuthorizedSection: false,
|
||||
contains: [] as string[],
|
||||
contains: [],
|
||||
notContains: ["## Authorized Senders", "Authorized senders:"],
|
||||
},
|
||||
] as const;
|
||||
]);
|
||||
|
||||
for (const testCase of cases) {
|
||||
const prompt = buildAgentSystemPrompt(testCase.params);
|
||||
|
||||
Reference in New Issue
Block a user