@@ -115,15 +115,18 @@ describe('Mocked API tests', () => {
115115 it ( 'should throw error with error code' , async ( ) => {
116116 const client = getLocalClient ( )
117117
118- nock ( 'http://localhost' )
119- . post ( createAssemblyRegex )
120- . reply ( 400 , { error : 'INVALID_FILE_META_DATA' , message : 'Invalid file metadata' } )
118+ nock ( 'http://localhost' ) . post ( createAssemblyRegex ) . reply ( 400 , {
119+ error : 'INVALID_FILE_META_DATA' ,
120+ message : 'Invalid file metadata' ,
121+ reason : 'Some reason' ,
122+ } )
121123
122124 await expect ( client . createAssembly ( ) ) . rejects . toThrow (
123125 expect . objectContaining < ApiError > ( {
124126 name : 'ApiError' ,
125127 code : 'INVALID_FILE_META_DATA' ,
126128 rawMessage : 'Invalid file metadata' ,
129+ reason : 'Some reason' ,
127130 message : 'API error (HTTP 400) INVALID_FILE_META_DATA: Invalid file metadata' ,
128131 } )
129132 )
@@ -165,6 +168,7 @@ describe('Mocked API tests', () => {
165168 expect . stringMatching ( ` at .+` ) ,
166169 expect . stringMatching ( ` code: 'INVALID_FILE_META_DATA',` ) ,
167170 expect . stringMatching ( ` rawMessage: 'Invalid file metadata',` ) ,
171+ expect . stringMatching ( ` reason: undefined,` ) ,
168172 expect . stringMatching (
169173 ` assemblySslUrl: 'https:\\/\\/api2-oltu\\.transloadit\\.com\\/assemblies\\/foo'`
170174 ) ,
0 commit comments