Skip to content

Commit

Permalink
fix: broken tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
LaunchDarklyReleaseBot committed Aug 26, 2023
1 parent a2dbfe4 commit cada2f6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ describe('given a requestor', () => {
},
};

requestor = new Requestor('sdkKey', new Configuration({}), basicPlatform.info, requests);
requestor = new Requestor(
'sdk-my-sdk-Key',
new Configuration({}),
basicPlatform.info,
requests,
);
});

it('gets data', (done) => {
Expand All @@ -91,7 +96,7 @@ describe('given a requestor', () => {

expect(requestsMade.length).toBe(1);
expect(requestsMade[0].url).toBe('https://sdk.launchdarkly.com/sdk/latest-all');
expect(requestsMade[0].options.headers?.authorization).toBe('sdkKey');
expect(requestsMade[0].options.headers?.authorization).toBe('sdk-my-sdk-Key');

done();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,37 @@ const makeInfo = (wrapperName?: string, wrapperVersion?: string, userAgentBase?:

it('sets SDK key', () => {
const config = new Configuration({});
const h = defaultHeaders('my-sdk-key', config, makeInfo());
expect(h).toMatchObject({ authorization: 'my-sdk-key' });
const h = defaultHeaders('sdk-my-sdk-key', config, makeInfo());
expect(h).toMatchObject({ authorization: 'sdk-my-sdk-key' });
});

it('sets the default user agent', () => {
const config = new Configuration({});
const h = defaultHeaders('my-sdk-key', config, makeInfo());
const h = defaultHeaders('sdk-my-sdk-key', config, makeInfo());
expect(h).toMatchObject({ 'user-agent': 'NodeJSClient/2.2.2' });
});

it('sets the SDK specific user agent', () => {
const config = new Configuration({});
const h = defaultHeaders('my-sdk-key', config, makeInfo(undefined, undefined, 'CATS'));
const h = defaultHeaders('sdk-my-sdk-key', config, makeInfo(undefined, undefined, 'CATS'));
expect(h).toMatchObject({ 'user-agent': 'CATS/2.2.2' });
});

it('does not include wrapper header by default', () => {
const config = new Configuration({});
const h = defaultHeaders('my-sdk-key', config, makeInfo());
const h = defaultHeaders('sdk-my-sdk-key', config, makeInfo());
expect(h['x-launchdarkly-wrapper']).toBeUndefined();
});

it('sets wrapper header with name only', () => {
const config = new Configuration({});
const h = defaultHeaders('my-sdk-key', config, makeInfo('my-wrapper'));
const h = defaultHeaders('sdk-my-sdk-key', config, makeInfo('my-wrapper'));
expect(h).toMatchObject({ 'x-launchdarkly-wrapper': 'my-wrapper' });
});

it('sets wrapper header with name and version', () => {
const config = new Configuration({});
const h = defaultHeaders('my-sdk-key', config, makeInfo('my-wrapper', '2.0'));
const h = defaultHeaders('sdk-my-sdk-key', config, makeInfo('my-wrapper', '2.0'));
expect(h).toMatchObject({ 'x-launchdarkly-wrapper': 'my-wrapper/2.0' });
});

Expand All @@ -61,7 +61,7 @@ it('sets the X-LaunchDarkly-Tags header with valid tags.', () => {
version: 'test-version',
},
});
const h = defaultHeaders('my-sdk-key', config, makeInfo('my-wrapper'));
const h = defaultHeaders('sdk-my-sdk-key', config, makeInfo('my-wrapper'));
expect(h).toMatchObject({
'x-launchdarkly-tags': 'application-id/test-application application-version/test-version',
});
Expand Down

0 comments on commit cada2f6

Please sign in to comment.