mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-25 13:21:15 +00:00
* refactor(channels): share plugin contract scaffolds * fix: preserve channel config hint metadata * chore: refresh Plugin SDK API baseline * ci: refresh plugin SDK surface budget * fix(ci): allow read-only state database boundary * fix(ci): dedupe read-only state database boundary
66 lines
2.2 KiB
TypeScript
66 lines
2.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { createChannelSecretTargetRegistryEntries } from "./channel-secret-basic-runtime.js";
|
|
|
|
describe("createChannelSecretTargetRegistryEntries", () => {
|
|
it("builds account and channel SecretInput targets with fixed registry metadata", () => {
|
|
expect(
|
|
createChannelSecretTargetRegistryEntries({
|
|
channelKey: "example",
|
|
account: ["token"],
|
|
channel: ["token"],
|
|
}),
|
|
).toEqual([
|
|
{
|
|
id: "channels.example.accounts.*.token",
|
|
targetType: "channels.example.accounts.*.token",
|
|
configFile: "openclaw.json",
|
|
pathPattern: "channels.example.accounts.*.token",
|
|
secretShape: "secret_input",
|
|
expectedResolvedValue: "string",
|
|
includeInPlan: true,
|
|
includeInConfigure: true,
|
|
includeInAudit: true,
|
|
},
|
|
{
|
|
id: "channels.example.token",
|
|
targetType: "channels.example.token",
|
|
configFile: "openclaw.json",
|
|
pathPattern: "channels.example.token",
|
|
secretShape: "secret_input",
|
|
expectedResolvedValue: "string",
|
|
includeInPlan: true,
|
|
includeInConfigure: true,
|
|
includeInAudit: true,
|
|
},
|
|
]);
|
|
});
|
|
|
|
it("supports sibling refs and CLI target aliases", () => {
|
|
expect(
|
|
createChannelSecretTargetRegistryEntries({
|
|
channelKey: "example",
|
|
account: [
|
|
{
|
|
path: "credentials",
|
|
refPath: "credentialsRef",
|
|
targetType: "channels.example.credentials",
|
|
targetTypeAliases: ["channels.example.accounts.*.credentials"],
|
|
secretShape: "sibling_ref",
|
|
expectedResolvedValue: "string-or-object",
|
|
accountIdPathSegmentIndex: 3,
|
|
},
|
|
],
|
|
})[0],
|
|
).toMatchObject({
|
|
id: "channels.example.accounts.*.credentials",
|
|
targetType: "channels.example.credentials",
|
|
targetTypeAliases: ["channels.example.accounts.*.credentials"],
|
|
pathPattern: "channels.example.accounts.*.credentials",
|
|
refPathPattern: "channels.example.accounts.*.credentialsRef",
|
|
secretShape: "sibling_ref",
|
|
expectedResolvedValue: "string-or-object",
|
|
accountIdPathSegmentIndex: 3,
|
|
});
|
|
});
|
|
});
|