Skip to content

Commit a90a55c

Browse files
fix: update test cases
1 parent c6587d1 commit a90a55c

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

test/retryPolicy/delivery-sdk-handlers.spec.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -648,11 +648,11 @@ describe('retryResponseErrorHandler', () => {
648648
await retryResponseErrorHandler(error, config, client);
649649
fail('Expected retryResponseErrorHandler to throw a custom error');
650650
} catch (customError: any) {
651-
expect(customError.status).toBe(400);
652-
expect(customError.statusText).toBe('Bad Request');
653-
expect(customError.error_message).toBe('Invalid request parameters');
654-
expect(customError.error_code).toBe(400);
655-
expect(customError.errors).toEqual(['Missing required field: title']);
651+
expect(customError.response.status).toBe(400);
652+
expect(customError.response.statusText).toBe('Bad Request');
653+
expect(customError.response.data.error_message).toBe('Invalid request parameters');
654+
expect(customError.response.data.error_code).toBe(400);
655+
expect(customError.response.data.errors).toEqual(['Missing required field: title']);
656656
}
657657
});
658658

@@ -677,11 +677,11 @@ describe('retryResponseErrorHandler', () => {
677677
await retryResponseErrorHandler(error, config, client);
678678
fail('Expected retryResponseErrorHandler to throw a custom error');
679679
} catch (customError: any) {
680-
expect(customError.status).toBe(500);
681-
expect(customError.statusText).toBe('Internal Server Error');
682-
expect(customError.error_message).toBe('Database connection failed');
683-
expect(customError.error_code).toBe(500);
684-
expect(customError.errors).toBe(null);
680+
expect(customError.response.status).toBe(500);
681+
expect(customError.response.statusText).toBe('Internal Server Error');
682+
expect(customError.response.data.error_message).toBe('Database connection failed');
683+
expect(customError.response.data.error_code).toBe(500);
684+
expect(customError.response.data.errors).toBe(null);
685685
}
686686
});
687687

@@ -709,11 +709,11 @@ describe('retryResponseErrorHandler', () => {
709709
await retryResponseErrorHandler(error, config, client);
710710
fail('Expected retryResponseErrorHandler to throw a custom error');
711711
} catch (customError: any) {
712-
expect(customError.status).toBe(422);
713-
expect(customError.statusText).toBe('Unprocessable Entity');
714-
expect(customError.error_message).toBe('Validation failed');
715-
expect(customError.error_code).toBe(422);
716-
expect(customError.errors).toEqual({
712+
expect(customError.response.status).toBe(422);
713+
expect(customError.response.statusText).toBe('Unprocessable Entity');
714+
expect(customError.response.data.error_message).toBe('Validation failed');
715+
expect(customError.response.data.error_code).toBe(422);
716+
expect(customError.response.data.errors).toEqual({
717717
title: ['Title is required'],
718718
content: ['Content cannot be empty'],
719719
});

0 commit comments

Comments
 (0)