Skip to content

Commit

Permalink
Add tests for issue #438
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkamyshev committed Mar 7, 2024
1 parent a324c6f commit add5a6c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions packages/core/src/query/__tests__/create_json-query.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,34 @@ describe('createJsonQuery', () => {
Query<void, unknown, JsonApiRequestError>
>();
});

test('allow to pass undefined in optional property headers, issue #438', () => {
const query = createJsonQuery({
request: {
url: 'https://salo.com',
method: 'GET',
headers: Math.random() > 0 ? {} : undefined,
},
response: { contract: unknownContract },
});

expectTypeOf(query).toEqualTypeOf<
Query<void, unknown, JsonApiRequestError>
>();
});

test('allow to pass undefined in optional property credentials, issue #438', () => {
const query = createJsonQuery({
request: {
url: 'https://salo.com',
method: 'GET',
credentials: Math.random() > 0 ? 'same-origin' : undefined,
},
response: { contract: unknownContract },
});

expectTypeOf(query).toEqualTypeOf<
Query<void, unknown, JsonApiRequestError>
>();
});
});

0 comments on commit add5a6c

Please sign in to comment.