Skip to content

Commit 6cc980f

Browse files
Ahmedhossamdevstainless-app[bot]
authored andcommitted
fix(tests): include API key in built URLs for request options
1 parent 75dbad7 commit 6cc980f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/index.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,22 +207,22 @@ describe('instantiate client', () => {
207207
test('in request options', () => {
208208
const client = new OnebusawaySDK({ apiKey: 'My API Key' });
209209
expect(client.buildURL('/foo', null, 'http://localhost:5000/option')).toEqual(
210-
'http://localhost:5000/option/foo',
210+
`http://localhost:5000/option/foo?key=${encodeURIComponent(client.apiKey)}`,
211211
);
212212
});
213213

214214
test('in request options overridden by client options', () => {
215215
const client = new OnebusawaySDK({ apiKey: 'My API Key', baseURL: 'http://localhost:5000/client' });
216216
expect(client.buildURL('/foo', null, 'http://localhost:5000/option')).toEqual(
217-
'http://localhost:5000/client/foo',
217+
`http://localhost:5000/client/foo?key=${encodeURIComponent(client.apiKey)}`,
218218
);
219219
});
220220

221221
test('in request options overridden by env variable', () => {
222222
process.env['ONEBUSAWAY_SDK_BASE_URL'] = 'http://localhost:5000/env';
223223
const client = new OnebusawaySDK({ apiKey: 'My API Key' });
224224
expect(client.buildURL('/foo', null, 'http://localhost:5000/option')).toEqual(
225-
'http://localhost:5000/env/foo',
225+
`http://localhost:5000/env/foo?key=${encodeURIComponent(client.apiKey)}`,
226226
);
227227
});
228228
});

0 commit comments

Comments
 (0)