@@ -125,6 +125,29 @@ describe("client is bound to TaskContext", () => {
125125 } ) ;
126126 } ) ;
127127
128+ it ( "defaults getXCom locator fields from ctx with snake_case wire names" , async ( ) => {
129+ const sent : Record < string , unknown > [ ] = [ ] ;
130+ const recordingComm = {
131+ request : async ( b : Record < string , unknown > ) => {
132+ sent . push ( b ) ;
133+ return { body : { type : "XComResult" , key : b . key , value : null } } ;
134+ } ,
135+ } as unknown as CommChannel ;
136+ const c = createCoordinatorClient ( recordingComm , FAKE_CTX ) ;
137+
138+ await c . getXCom ( { key : "k" } ) ;
139+
140+ expect ( sent [ 0 ] ) . toEqual ( {
141+ type : "GetXCom" ,
142+ key : "k" ,
143+ dag_id : "d" ,
144+ task_id : "t" ,
145+ run_id : "r" ,
146+ map_index : null ,
147+ include_prior_dates : false ,
148+ } ) ;
149+ } ) ;
150+
128151 it ( "maps camelCase public XCom options to snake_case supervisor fields" , async ( ) => {
129152 const sent : Record < string , unknown > [ ] = [ ] ;
130153 const recordingComm = {
@@ -197,6 +220,23 @@ describe("getConnection", () => {
197220 } ) ;
198221 } ) ;
199222
223+ it ( "coerces absent optional wire fields to null public fields" , async ( ) => {
224+ const c = client ( [
225+ { body : { type : "ConnectionResult" , conn_id : "bare" , conn_type : "generic" } } ,
226+ ] ) ;
227+
228+ await expect ( c . getConnection ( "bare" ) ) . resolves . toEqual ( {
229+ id : "bare" ,
230+ type : "generic" ,
231+ host : null ,
232+ schema : null ,
233+ login : null ,
234+ password : null ,
235+ port : null ,
236+ extra : null ,
237+ } ) ;
238+ } ) ;
239+
200240 it ( "returns null for missing connections" , async ( ) => {
201241 const c = client ( [ { body : { type : "ErrorResponse" , error : "CONNECTION_NOT_FOUND" } } ] ) ;
202242 expect ( await c . getConnection ( "missing" ) ) . toBeNull ( ) ;
0 commit comments