@@ -271,69 +271,55 @@ describe('put', () => {
271271 const key = 'some-key'
272272 const value = 'some-value'
273273
274- mockExponentialBackoff . mockResolvedValue ( wrapInFetchError ( 401 , 'myerror' ) )
274+ mockExponentialBackoff . mockResolvedValue ( wrapInFetchError ( 401 ) )
275275 await expect ( store . put ( key , value ) ) . rejects . toThrow (
276276 expect . objectContaining ( {
277277 sdkDetails : expect . objectContaining ( {
278278 requestId : 'fake-req-id'
279279 } ) ,
280- message : '[AdobeStateLib:ERROR_UNAUTHORIZED] myerror '
280+ message : '[AdobeStateLib:ERROR_UNAUTHORIZED] you are not authorized to access State service '
281281 } ) )
282282 } )
283283
284284 test ( 'coverage: 403 error' , async ( ) => {
285285 const key = 'some-key'
286286 const value = 'some-value'
287287
288- mockExponentialBackoff . mockResolvedValue ( wrapInFetchError ( 403 , 'myerror' ) )
288+ mockExponentialBackoff . mockResolvedValue ( wrapInFetchError ( 403 ) )
289289 await expect ( store . put ( key , value ) ) . rejects . toThrow (
290290 expect . objectContaining ( {
291291 sdkDetails : expect . objectContaining ( {
292292 requestId : 'fake-req-id'
293293 } ) ,
294- message : '[AdobeStateLib:ERROR_FORBIDDEN] myerror '
294+ message : '[AdobeStateLib:ERROR_BAD_CREDENTIALS] cannot access State service, make sure your credentials are valid '
295295 } ) )
296296 } )
297297
298298 test ( 'coverage: 413 error' , async ( ) => {
299299 const key = 'some-key'
300300 const value = 'some-value'
301301
302- mockExponentialBackoff . mockResolvedValue ( wrapInFetchError ( 413 , 'myerror' ) )
302+ mockExponentialBackoff . mockResolvedValue ( wrapInFetchError ( 413 ) )
303303 await expect ( store . put ( key , value ) ) . rejects . toThrow (
304304 expect . objectContaining ( {
305305 sdkDetails : expect . objectContaining ( {
306306 requestId : 'fake-req-id'
307307 } ) ,
308- message : '[AdobeStateLib:ERROR_PAYLOAD_TOO_LARGE] myerror '
308+ message : '[AdobeStateLib:ERROR_PAYLOAD_TOO_LARGE] key, value or request payload is too large State service '
309309 } ) )
310310 } )
311311
312312 test ( 'coverage: 429 error' , async ( ) => {
313313 const key = 'some-key'
314314 const value = 'some-value'
315315
316- mockExponentialBackoff . mockResolvedValue ( wrapInFetchError ( 429 , 'myerror' ) )
316+ mockExponentialBackoff . mockResolvedValue ( wrapInFetchError ( 429 ) )
317317 await expect ( store . put ( key , value ) ) . rejects . toThrow (
318318 expect . objectContaining ( {
319319 sdkDetails : expect . objectContaining ( {
320320 requestId : 'fake-req-id'
321321 } ) ,
322- message : '[AdobeStateLib:ERROR_REQUEST_RATE_TOO_HIGH] myerror'
323- } ) )
324- } )
325- test ( 'coverage: unknown user error' , async ( ) => {
326- const key = 'some-key'
327- const value = 'some-value'
328- const responseBody = 'error: this is the response body'
329-
330- mockExponentialBackoff . mockResolvedValue ( wrapInFetchError ( 400 , responseBody ) )
331- await expect ( store . put ( key , value ) ) . rejects . toThrow (
332- expect . objectContaining ( {
333- sdkDetails : expect . objectContaining ( {
334- requestId : 'fake-req-id'
335- } ) ,
336- message : `[AdobeStateLib:ERROR_BAD_REQUEST] ${ responseBody } `
322+ message : '[AdobeStateLib:ERROR_REQUEST_RATE_TOO_HIGH] Request rate too high. Please retry after sometime.'
337323 } ) )
338324 } )
339325
@@ -348,7 +334,7 @@ describe('put', () => {
348334 sdkDetails : expect . objectContaining ( {
349335 requestId : 'fake-req-id'
350336 } ) ,
351- message : `[AdobeStateLib:ERROR_INTERNAL] unexpected response from State service with body: ${ responseBody } `
337+ message : `[AdobeStateLib:ERROR_INTERNAL] unexpected response from State service with status: 500 body: ${ responseBody } `
352338 } ) )
353339 } )
354340
0 commit comments