@@ -16,10 +16,9 @@ function setup(promise, mockName, params = {}) {
1616}
1717
1818describe ( 'Rest App Action Call' , { concurrent : true } , ( ) => {
19- it ( 'should get structured App Action Call via new route ' , async ( ) => {
19+ it ( 'should get structured App Action Call' , async ( ) => {
2020 const structuredCall : any = {
21- sys : { id : 'call-id' , type : 'AppActionCall' } ,
22- status : 'processing' ,
21+ sys : { id : 'call-id' , type : 'AppActionCall' , status : 'processing' } ,
2322 }
2423
2524 const { httpMock } = setup ( Promise . resolve ( { data : structuredCall } ) , 'appActionCallResponse' )
@@ -38,7 +37,7 @@ describe('Rest App Action Call', { concurrent: true }, () => {
3837 )
3938 } )
4039
41- it ( 'should get raw response via new route ' , async ( ) => {
40+ it ( 'should get raw response' , async ( ) => {
4241 const rawResponse : any = {
4342 sys : { id : 'call-id' , type : 'AppActionCallResponse' } ,
4443 response : { body : 'OK' , headers : { contentType : 'application/json' } } ,
@@ -61,16 +60,13 @@ describe('Rest App Action Call', { concurrent: true }, () => {
6160 } )
6261
6362 it ( 'should create with result and poll until completion' , async ( ) => {
64- // First POST returns the created call with sys.id; then GET returns processing, then succeeded
65- const createdCall : any = { sys : { id : 'call-id' , type : 'AppActionCall' } }
66- const processing : any = { sys : { id : 'call-id' , type : 'AppActionCall' } , status : 'processing' }
63+ // First POST and next GET returns processing call with sys.id; , then succeeded
64+ const processing : any = { sys : { id : 'call-id' , type : 'AppActionCall' , status : 'processing' } }
6765 const succeeded : any = {
68- sys : { id : 'call-id' , type : 'AppActionCall' } ,
69- status : 'succeeded' ,
70- result : { ok : true } ,
66+ sys : { id : 'call-id' , type : 'AppActionCall' , status : 'succeeded' , result : { ok : true } } ,
7167 }
7268
73- const { httpMock } = setup ( Promise . resolve ( { data : createdCall } ) , 'appActionCallResponse' )
69+ const { httpMock } = setup ( Promise . resolve ( { data : processing } ) , 'appActionCallResponse' )
7470
7571 httpMock . get
7672 . mockImplementationOnce ( ( ) => Promise . resolve ( { data : processing } ) )
@@ -105,10 +101,9 @@ describe('Rest App Action Call', { concurrent: true }, () => {
105101 } )
106102
107103 it ( 'createWithResult times out when status stays processing' , async ( ) => {
108- const createdCall : any = { sys : { id : 'call-id' , type : 'AppActionCall' } }
109- const processing : any = { sys : { id : 'call-id' , type : 'AppActionCall' } , status : 'processing' }
104+ const processing : any = { sys : { id : 'call-id' , type : 'AppActionCall' , status : 'processing' } }
110105
111- const { httpMock } = setup ( Promise . resolve ( { data : createdCall } ) , 'appActionCallResponse' )
106+ const { httpMock } = setup ( Promise . resolve ( { data : processing } ) , 'appActionCallResponse' )
112107
113108 // Always return processing to trigger timeout
114109 httpMock . get . mockImplementation ( ( ) => Promise . resolve ( { data : processing } ) )
@@ -140,11 +135,14 @@ describe('Rest App Action Call', { concurrent: true }, () => {
140135 } )
141136
142137 it ( 'createWithResult resolves with failed status and error intact' , async ( ) => {
143- const createdCall : any = { sys : { id : 'call-id' , type : 'AppActionCall' } }
138+ const createdCall : any = { sys : { id : 'call-id' , type : 'AppActionCall' , status : 'processing' } }
144139 const failed : any = {
145- sys : { id : 'call-id' , type : 'AppActionCall' } ,
146- status : 'failed' ,
147- error : { sys : { type : 'Error' , id : 'ValidationError' } , message : 'invalid' } ,
140+ sys : {
141+ id : 'call-id' ,
142+ type : 'AppActionCall' ,
143+ status : 'failed' ,
144+ error : { sys : { type : 'Error' , id : 'ValidationError' } , message : 'invalid' } ,
145+ } ,
148146 }
149147
150148 const { httpMock } = setup ( Promise . resolve ( { data : createdCall } ) , 'appActionCallResponse' )
@@ -167,7 +165,7 @@ describe('Rest App Action Call', { concurrent: true }, () => {
167165 } )
168166
169167 it ( 'createWithResult retries on thrown GET errors then times out' , async ( ) => {
170- const createdCall : any = { sys : { id : 'call-id' , type : 'AppActionCall' } }
168+ const createdCall : any = { sys : { id : 'call-id' , type : 'AppActionCall' , status : 'processing' } }
171169 const { httpMock } = setup ( Promise . resolve ( { data : createdCall } ) , 'appActionCallResponse' )
172170
173171 httpMock . get . mockRejectedValue ( new Error ( 'not ready' ) )
0 commit comments