mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-16 04:00:45 +00:00
test: tighten channel contract api assertions
This commit is contained in:
@@ -44,6 +44,12 @@ function requireChannelSecretContractApi(
|
||||
return api;
|
||||
}
|
||||
|
||||
function expectDiscordTokenRegistryEntry(contractApi: ChannelSecretContractApi): void {
|
||||
const entries = contractApi.secretTargetRegistryEntries ?? [];
|
||||
const entry = entries.find((record) => record.id === "channels.discord.token");
|
||||
expect(entry?.id).toBe("channels.discord.token");
|
||||
}
|
||||
|
||||
function channelSecretContractModuleSource(channelId: string) {
|
||||
return `
|
||||
module.exports = {
|
||||
@@ -114,13 +120,7 @@ describe("external channel secret contract api", () => {
|
||||
});
|
||||
|
||||
const contractApi = requireChannelSecretContractApi(api);
|
||||
expect(contractApi.secretTargetRegistryEntries).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: "channels.discord.token",
|
||||
}),
|
||||
]),
|
||||
);
|
||||
expectDiscordTokenRegistryEntry(contractApi);
|
||||
expect(contractApi.collectRuntimeConfigAssignments).toBeTypeOf("function");
|
||||
});
|
||||
|
||||
@@ -151,13 +151,7 @@ describe("external channel secret contract api", () => {
|
||||
});
|
||||
|
||||
const contractApi = requireChannelSecretContractApi(api);
|
||||
expect(contractApi.secretTargetRegistryEntries).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: "channels.discord.token",
|
||||
}),
|
||||
]),
|
||||
);
|
||||
expectDiscordTokenRegistryEntry(contractApi);
|
||||
expect(contractApi.collectRuntimeConfigAssignments).toBeTypeOf("function");
|
||||
});
|
||||
|
||||
@@ -199,13 +193,7 @@ describe("external channel secret contract api", () => {
|
||||
env,
|
||||
});
|
||||
const contractApi = requireChannelSecretContractApi(api);
|
||||
expect(contractApi.secretTargetRegistryEntries).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: "channels.discord.token",
|
||||
}),
|
||||
]),
|
||||
);
|
||||
expectDiscordTokenRegistryEntry(contractApi);
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user