@@ -98,6 +98,59 @@ describe("buildDiscordInteractiveComponents", () => {
9898 } ) ;
9999 } ) ;
100100
101+ it . each ( [
102+ {
103+ name : "approval" ,
104+ action : {
105+ type : "approval" as const ,
106+ approvalId : "approval-1" ,
107+ approvalKind : "exec" as const ,
108+ decision : "allow-once" as const ,
109+ } ,
110+ expected : {
111+ internalCustomId : "execapproval:kind=exec;id=approval-1;action=allow-once" ,
112+ } ,
113+ } ,
114+ {
115+ name : "callback" ,
116+ action : { type : "callback" as const , value : "plugin:opaque|value" } ,
117+ expected : { callbackData : "plugin:opaque|value" , callbackDataKind : "callback" } ,
118+ } ,
119+ {
120+ name : "command" ,
121+ action : { type : "command" as const , command : "/codex inspect" } ,
122+ expected : { callbackData : "/codex inspect" , callbackDataKind : "command" } ,
123+ } ,
124+ {
125+ name : "question" ,
126+ action : {
127+ type : "question" as const ,
128+ questionId : "ask_0123456789abcdef0123456789abcdef" ,
129+ optionValue : "Production" ,
130+ } ,
131+ expected : { internalCustomId : "ocq:id=ask_0123456789abcdef0123456789abcdef;i=1" } ,
132+ } ,
133+ ] ) ( "preserves typed $name authority through the legacy renderer" , ( { action, expected } ) => {
134+ expect (
135+ buildDiscordInteractiveComponents ( {
136+ blocks : [
137+ {
138+ type : "buttons" ,
139+ buttons : [
140+ {
141+ label : "Unavailable" ,
142+ action : { type : "web-app" , widgetId : "invalid" } ,
143+ } ,
144+ { label : "Continue" , action } ,
145+ ] ,
146+ } ,
147+ ] ,
148+ } ) ,
149+ ) . toMatchObject ( {
150+ blocks : [ { type : "actions" , buttons : [ { label : "Continue" , ...expected } ] } ] ,
151+ } ) ;
152+ } ) ;
153+
101154 it . each ( [ "url" , "web-app" ] as const ) (
102155 "renders typed %s actions as Discord link buttons" ,
103156 ( type ) => {
0 commit comments