@@ -3,21 +3,17 @@ import { Command } from "commander";
33import type { QaRunnerCliContribution } from "openclaw/plugin-sdk/qa-runner-runtime" ;
44import { beforeEach , describe , expect , it , vi } from "vitest" ;
55
6- const { listQaRunnerCliContributions, runDiscord , runSlack , runTelegram, runWhatsApp } = vi . hoisted (
6+ const { listQaRunnerCliContributions, runLiveTransportQaSuiteCommand , runTelegram } = vi . hoisted (
77 ( ) => ( {
88 listQaRunnerCliContributions : vi . fn < ( ) => QaRunnerCliContribution [ ] > ( ( ) => [ ] ) ,
9- runDiscord : vi . fn ( ) ,
10- runSlack : vi . fn ( ) ,
9+ runLiveTransportQaSuiteCommand : vi . fn ( ) ,
1110 runTelegram : vi . fn ( ) ,
12- runWhatsApp : vi . fn ( ) ,
1311 } ) ,
1412) ;
1513
1614vi . mock ( "openclaw/plugin-sdk/qa-runner-runtime" , ( ) => ( { listQaRunnerCliContributions } ) ) ;
17- vi . mock ( "./discord/cli.runtime.js" , ( ) => ( { runQaDiscordCommand : runDiscord } ) ) ;
18- vi . mock ( "./slack/cli.runtime.js" , ( ) => ( { runQaSlackCommand : runSlack } ) ) ;
15+ vi . mock ( "./shared/live-transport-suite.runtime.js" , ( ) => ( { runLiveTransportQaSuiteCommand } ) ) ;
1916vi . mock ( "./telegram/cli.runtime.js" , ( ) => ( { runQaTelegramCommand : runTelegram } ) ) ;
20- vi . mock ( "./whatsapp/cli.runtime.js" , ( ) => ( { runQaWhatsAppCommand : runWhatsApp } ) ) ;
2117
2218import { listLiveTransportQaAdapterFactories , listLiveTransportQaCliRegistrations } from "./cli.js" ;
2319
@@ -37,22 +33,37 @@ describe("live transport QA contributions", () => {
3733 ] ) ;
3834 } ) ;
3935
40- it . each ( [
41- [ "telegram" , runTelegram ] ,
42- [ "discord" , runDiscord ] ,
43- [ "slack" , runSlack ] ,
44- [ "whatsapp" , runWhatsApp ] ,
45- ] as const ) ( "keeps the shipped %s command runner" , async ( commandName , runCommand ) => {
36+ it . each ( [ "discord" , "slack" , "whatsapp" ] as const ) (
37+ "routes the shipped %s command through the shared suite host" ,
38+ async ( commandName ) => {
39+ const registration = listLiveTransportQaCliRegistrations ( ) . find (
40+ ( candidate ) => candidate . commandName === commandName ,
41+ ) ;
42+ const qa = new Command ( ) ;
43+ registration ?. register ( qa ) ;
44+
45+ await qa . parseAsync ( [ "node" , "openclaw" , commandName , "--scenario" , `${ commandName } -canary` ] ) ;
46+
47+ expect ( runLiveTransportQaSuiteCommand ) . toHaveBeenCalledWith (
48+ expect . objectContaining ( {
49+ channelId : commandName ,
50+ options : expect . objectContaining ( { scenarioIds : [ `${ commandName } -canary` ] } ) ,
51+ } ) ,
52+ ) ;
53+ } ,
54+ ) ;
55+
56+ it ( "keeps the specialized Telegram command runner" , async ( ) => {
4657 const registration = listLiveTransportQaCliRegistrations ( ) . find (
47- ( candidate ) => candidate . commandName === commandName ,
58+ ( candidate ) => candidate . commandName === "telegram" ,
4859 ) ;
4960 const qa = new Command ( ) ;
5061 registration ?. register ( qa ) ;
5162
52- await qa . parseAsync ( [ "node" , "openclaw" , commandName , "--scenario" , ` ${ commandName } -canary` ] ) ;
63+ await qa . parseAsync ( [ "node" , "openclaw" , "telegram" , "--scenario" , "telegram -canary" ] ) ;
5364
54- expect ( runCommand ) . toHaveBeenCalledWith (
55- expect . objectContaining ( { scenarioIds : [ ` ${ commandName } -canary` ] } ) ,
65+ expect ( runTelegram ) . toHaveBeenCalledWith (
66+ expect . objectContaining ( { scenarioIds : [ "telegram -canary" ] } ) ,
5667 ) ;
5768 } ) ;
5869} ) ;
0 commit comments