@@ -3,15 +3,15 @@ import { createRequire } from "node:module";
33import { describe , expect , it } from "vitest" ;
44import type { OpenClawConfig } from "../../config/types.openclaw.js" ;
55import {
6- hasBundledChannelConfiguredState ,
7- listBundledChannelIdsWithConfiguredState ,
8- } from "./configured -state.js" ;
6+ hasBundledChannelPackageState ,
7+ listBundledChannelIdsForPackageState ,
8+ } from "./package -state-probes .js" ;
99
1010const nodeRequire = createRequire ( import . meta. url ) ;
1111
1212describe ( "bundled channel configured-state metadata" , ( ) => {
1313 it ( "lists the shipped metadata-first configured-state channels" , ( ) => {
14- expect ( listBundledChannelIdsWithConfiguredState ( ) ) . toEqual ( [
14+ expect ( listBundledChannelIdsForPackageState ( "configuredState" ) ) . toEqual ( [
1515 "buzz" ,
1616 "clickclack" ,
1717 "discord" ,
@@ -37,28 +37,32 @@ describe("bundled channel configured-state metadata", () => {
3737
3838 it ( "resolves Discord, Slack, Telegram, and IRC env probes without full plugin loads" , ( ) => {
3939 expect (
40- hasBundledChannelConfiguredState ( {
40+ hasBundledChannelPackageState ( {
41+ metadataKey : "configuredState" ,
4142 channelId : "discord" ,
4243 cfg : { } ,
4344 env : { DISCORD_BOT_TOKEN : "token" } ,
4445 } ) ,
4546 ) . toBe ( true ) ;
4647 expect (
47- hasBundledChannelConfiguredState ( {
48+ hasBundledChannelPackageState ( {
49+ metadataKey : "configuredState" ,
4850 channelId : "slack" ,
4951 cfg : { } ,
5052 env : { SLACK_BOT_TOKEN : "xoxb-test" , SLACK_APP_TOKEN : "xapp-test" } ,
5153 } ) ,
5254 ) . toBe ( true ) ;
5355 expect (
54- hasBundledChannelConfiguredState ( {
56+ hasBundledChannelPackageState ( {
57+ metadataKey : "configuredState" ,
5558 channelId : "telegram" ,
5659 cfg : { } ,
5760 env : { TELEGRAM_BOT_TOKEN : "token" } ,
5861 } ) ,
5962 ) . toBe ( true ) ;
6063 expect (
61- hasBundledChannelConfiguredState ( {
64+ hasBundledChannelPackageState ( {
65+ metadataKey : "configuredState" ,
6266 channelId : "irc" ,
6367 cfg : { } ,
6468 env : { IRC_HOST : "irc.example.com" , IRC_NICK : "openclaw" } ,
@@ -79,7 +83,9 @@ describe("bundled channel configured-state metadata", () => {
7983 { channelId : "nextcloud-talk" , env : { NEXTCLOUD_TALK_BOT_SECRET : "secret" } } ,
8084 { channelId : "zalo" , env : { ZALO_WEBHOOK_SECRET : "secret" } } ,
8185 ] ) ( "rejects incomplete $channelId environment credentials" , ( { channelId, env } ) => {
82- expect ( hasBundledChannelConfiguredState ( { channelId, cfg : { } , env } ) ) . toBe ( false ) ;
86+ expect (
87+ hasBundledChannelPackageState ( { metadataKey : "configuredState" , channelId, cfg : { } , env } ) ,
88+ ) . toBe ( false ) ;
8389 } ) ;
8490
8591 it . each ( [
@@ -109,12 +115,15 @@ describe("bundled channel configured-state metadata", () => {
109115 env : { SYNOLOGY_CHAT_TOKEN : "token" , SYNOLOGY_CHAT_INCOMING_URL : "https://example.test" } ,
110116 } ,
111117 ] ) ( "accepts complete $channelId environment credentials" , ( { channelId, env } ) => {
112- expect ( hasBundledChannelConfiguredState ( { channelId, cfg : { } , env } ) ) . toBe ( true ) ;
118+ expect (
119+ hasBundledChannelPackageState ( { metadataKey : "configuredState" , channelId, cfg : { } , env } ) ,
120+ ) . toBe ( true ) ;
113121 } ) ;
114122
115123 it ( "keeps explicit blank Teams credentials authoritative over ambient credentials" , ( ) => {
116124 expect (
117- hasBundledChannelConfiguredState ( {
125+ hasBundledChannelPackageState ( {
126+ metadataKey : "configuredState" ,
118127 channelId : "msteams" ,
119128 cfg : { channels : { msteams : { appId : "" , appPassword : "" , tenantId : "" } } } ,
120129 env : {
@@ -168,15 +177,18 @@ describe("bundled channel configured-state metadata", () => {
168177 cfg : OpenClawConfig ;
169178 env : NodeJS . ProcessEnv ;
170179 } > ) ( "accepts the owner-specific $name contract" , ( { channelId, cfg, env } ) => {
171- expect ( hasBundledChannelConfiguredState ( { channelId, cfg, env } ) ) . toBe ( true ) ;
180+ expect (
181+ hasBundledChannelPackageState ( { metadataKey : "configuredState" , channelId, cfg, env } ) ,
182+ ) . toBe ( true ) ;
172183 } ) ;
173184
174185 it ( "uses declarative env metadata without a TypeScript source require hook" , ( ) => {
175186 const previousTsHook = nodeRequire . extensions [ ".ts" ] ;
176187 delete nodeRequire . extensions [ ".ts" ] ;
177188 try {
178189 expect (
179- hasBundledChannelConfiguredState ( {
190+ hasBundledChannelPackageState ( {
191+ metadataKey : "configuredState" ,
180192 channelId : "discord" ,
181193 cfg : { } ,
182194 env : { DISCORD_BOT_TOKEN : "token" } ,
0 commit comments