Skip to content

Commit 2c397e5

Browse files
Fix default http client (readmeio#201)
* Fix default http client * test: fix snapshot * test: add comprehensive test to check all targets * refactor: slightly better test pattern --------- Co-authored-by: Kanad Gupta <[email protected]>
1 parent a15b18c commit 2c397e5

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/helpers/__snapshots__/utils.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ exports[`availableTargets > returns all available targets 1`] = `
7878
"title": "HTTP/1.1",
7979
},
8080
],
81-
"default": "1.1",
81+
"default": "http1.1",
8282
"key": "http",
8383
"title": "HTTP",
8484
},

src/helpers/utils.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ describe('availableTargets', () => {
66
it('returns all available targets', () => {
77
expect(availableTargets()).toMatchSnapshot();
88
});
9+
10+
describe('default value check', () => {
11+
it.each(availableTargets().map(target => [target.title, target]))(
12+
'should match `default` value with one of the client keys (%s)',
13+
(_, target) => {
14+
expect(target.clients).toContainEqual(expect.objectContaining({ key: target.default }));
15+
},
16+
);
17+
});
918
});
1019

1120
describe('extname', () => {

src/targets/http/target.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const http: Target = {
66
info: {
77
key: 'http',
88
title: 'HTTP',
9-
default: '1.1',
9+
default: 'http1.1',
1010
},
1111
clientsById: {
1212
'http1.1': http11,

0 commit comments

Comments
 (0)