Skip to content

Commit 4397cb1

Browse files
committed
test: added RESTController test with missing 'access-control-expose-headers' patterns
1 parent 1c8fafe commit 4397cb1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/__tests__/RESTController-test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,20 @@ describe('RESTController', () => {
5555
expect(status).toBe(200);
5656
});
5757

58+
it('resolves without error when access-control-expose-headers header is missing', async () => {
59+
mockFetch([{ status: 200, response: { success: true } }], {});
60+
const { response, status } = await RESTController.ajax('POST', 'users', {});
61+
expect(response).toEqual({ success: true });
62+
expect(status).toBe(200);
63+
});
64+
65+
it('resolves without error when access-control-expose-headers header is empty', async () => {
66+
mockFetch([{ status: 200, response: { success: true } }], { 'access-control-expose-headers': '' });
67+
const { response, status } = await RESTController.ajax('POST', 'users', {});
68+
expect(response).toEqual({ success: true });
69+
expect(status).toBe(200);
70+
});
71+
5872
it('retries on 5XX errors', async () => {
5973
mockFetch([{ status: 500 }, { status: 500 }, { status: 200, response: { success: true } }])
6074
const { response, status } = await RESTController.ajax('POST', 'users', {});

0 commit comments

Comments
 (0)