-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91d0211
commit 1857143
Showing
6 changed files
with
29 additions
and
24 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "launchdarkly-react-client-sdk", | ||
"version": "2.17.1", | ||
"version": "2.16.1", | ||
"description": "LaunchDarkly SDK for React", | ||
"author": "LaunchDarkly <[email protected]>", | ||
"license": "Apache-2.0", | ||
|
@@ -17,7 +17,7 @@ | |
"scripts": { | ||
"test": "jest", | ||
"test:junit": "jest --ci --reporters=default --reporters=jest-junit", | ||
"build": "rimraf lib/* && tsc && rm -rf lib/*.test.*", | ||
"build": "rimraf lib/* && tsc && mv lib/src/* lib && rimraf lib/package.json lib/src lib/*.test.*", | ||
"lint": "tslint -p tsconfig.json 'src/**/*.ts*'", | ||
"lint:all": "npm run lint", | ||
"check-typescript": "tsc", | ||
|
@@ -56,7 +56,7 @@ | |
"typescript": "^3.6.2" | ||
}, | ||
"dependencies": { | ||
"launchdarkly-js-client-sdk": "2.16.3", | ||
"launchdarkly-js-client-sdk": "2.17.0", | ||
"lodash.camelcase": "^4.3.0", | ||
"uuid": "^3.3.2" | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ jest.mock('launchdarkly-js-client-sdk', () => { | |
initialize: jest.fn(), | ||
}; | ||
}); | ||
jest.mock('../package.json', () => ({ version: 'mock.version' })); | ||
|
||
import { initialize, LDClient, LDOptions, LDUser } from 'launchdarkly-js-client-sdk'; | ||
import { defaultReactOptions, LDReactOptions } from './types'; | ||
|
@@ -16,6 +17,8 @@ const ldClientInitialize = initialize as jest.Mock; | |
const clientSideID = 'deadbeef'; | ||
const defaultUser: LDUser = { key: 'abcdef' }; | ||
const options: LDOptions = { bootstrap: 'localStorage' }; | ||
const extraOptionsAddedBySdk: LDOptions = { wrapperName: 'react-client-sdk', wrapperVersion: 'mock.version' }; | ||
const expectedOptions: LDOptions = { ...options, ...extraOptionsAddedBySdk }; | ||
const flags = { 'test-flag': false, 'another-test-flag': true }; | ||
|
||
describe('initLDClient', () => { | ||
|
@@ -41,15 +44,15 @@ describe('initLDClient', () => { | |
const anonUser: LDUser = { anonymous: true }; | ||
await initLDClient(clientSideID); | ||
|
||
expect(ldClientInitialize.mock.calls[0]).toEqual([clientSideID, anonUser, {}]); | ||
expect(ldClientInitialize.mock.calls[0]).toEqual([clientSideID, anonUser, extraOptionsAddedBySdk]); | ||
expect(mockLDClient.variation).toHaveBeenCalledTimes(0); | ||
}); | ||
|
||
test('initialise with custom user and options', async () => { | ||
const customUser = { key: '[email protected]' }; | ||
await initLDClient(clientSideID, customUser, defaultReactOptions, options); | ||
|
||
expect(ldClientInitialize.mock.calls[0]).toEqual([clientSideID, customUser, options]); | ||
expect(ldClientInitialize.mock.calls[0]).toEqual([clientSideID, customUser, expectedOptions]); | ||
expect(mockLDClient.variation).toHaveBeenCalledTimes(0); | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters