-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements a
getFeatureFlag
to avoid option drilling (#9618)
* Implement a simple feature-flag client to avoid option drilling * Ensure feature flag client is initialised in workers * Rename featureFlags -> featureFlagValues * Avoid depending on ephemeral flag in test
- Loading branch information
Showing
5 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// @flow strict | ||
import assert from 'assert'; | ||
import {getFeatureFlag, DEFAULT_FEATURE_FLAGS, setFeatureFlags} from '../src'; | ||
|
||
describe('feature-flag test', () => { | ||
beforeEach(() => { | ||
setFeatureFlags(DEFAULT_FEATURE_FLAGS); | ||
}); | ||
|
||
it('has defaults', () => { | ||
assert.equal( | ||
getFeatureFlag('exampleFeature'), | ||
DEFAULT_FEATURE_FLAGS.exampleFeature, | ||
); | ||
}); | ||
|
||
it('can override', () => { | ||
setFeatureFlags({...DEFAULT_FEATURE_FLAGS, exampleFeature: true}); | ||
assert.equal(getFeatureFlag('exampleFeature'), true); | ||
}); | ||
}); |
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