-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ [RUMF-1529] use an enum for experimental features
- Loading branch information
1 parent
8fc4fd9
commit 361fba3
Showing
28 changed files
with
153 additions
and
83 deletions.
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
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
26 changes: 15 additions & 11 deletions
26
packages/core/src/domain/configuration/experimentalFeatures.spec.ts
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,39 +1,43 @@ | ||
import type { ExperimentalFeature } from './experimentalFeatures' | ||
import { | ||
updateExperimentalFeatures, | ||
isExperimentalFeatureEnabled, | ||
resetExperimentalFeatures, | ||
} from './experimentalFeatures' | ||
|
||
const TEST_FEATURE_FLAG_ONE = 'foo' as ExperimentalFeature | ||
const TEST_FEATURE_FLAG_TWO = 'bar' as ExperimentalFeature | ||
|
||
describe('experimentalFeatures', () => { | ||
afterEach(() => { | ||
resetExperimentalFeatures() | ||
}) | ||
|
||
it('initial state is empty', () => { | ||
expect(isExperimentalFeatureEnabled('foo')).toBeFalse() | ||
expect(isExperimentalFeatureEnabled('bar')).toBeFalse() | ||
expect(isExperimentalFeatureEnabled(TEST_FEATURE_FLAG_ONE)).toBeFalse() | ||
expect(isExperimentalFeatureEnabled(TEST_FEATURE_FLAG_TWO)).toBeFalse() | ||
}) | ||
|
||
it('should define enabled experimental features', () => { | ||
updateExperimentalFeatures(['foo']) | ||
expect(isExperimentalFeatureEnabled('foo')).toBeTrue() | ||
expect(isExperimentalFeatureEnabled('bar')).toBeFalse() | ||
updateExperimentalFeatures([TEST_FEATURE_FLAG_ONE]) | ||
expect(isExperimentalFeatureEnabled(TEST_FEATURE_FLAG_ONE)).toBeTrue() | ||
expect(isExperimentalFeatureEnabled(TEST_FEATURE_FLAG_TWO)).toBeFalse() | ||
}) | ||
|
||
it('should allow to be shared between products', () => { | ||
updateExperimentalFeatures(['foo']) | ||
updateExperimentalFeatures(['bar']) | ||
updateExperimentalFeatures([TEST_FEATURE_FLAG_ONE]) | ||
updateExperimentalFeatures([TEST_FEATURE_FLAG_TWO]) | ||
|
||
expect(isExperimentalFeatureEnabled('foo')).toBeTrue() | ||
expect(isExperimentalFeatureEnabled('bar')).toBeTrue() | ||
expect(isExperimentalFeatureEnabled(TEST_FEATURE_FLAG_ONE)).toBeTrue() | ||
expect(isExperimentalFeatureEnabled(TEST_FEATURE_FLAG_TWO)).toBeTrue() | ||
}) | ||
|
||
it('should support some edge cases', () => { | ||
updateExperimentalFeatures(['foo']) | ||
updateExperimentalFeatures([TEST_FEATURE_FLAG_ONE]) | ||
updateExperimentalFeatures(undefined) | ||
updateExperimentalFeatures([]) | ||
updateExperimentalFeatures([11 as any]) | ||
|
||
expect(isExperimentalFeatureEnabled('foo')).toBeTrue() | ||
expect(isExperimentalFeatureEnabled(TEST_FEATURE_FLAG_ONE)).toBeTrue() | ||
}) | ||
}) |
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
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
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
Oops, something went wrong.