This repository has been archived by the owner on Jan 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change adds a new property to RecoilEnv, RECOIL_GKS_ENABLED, which can be used to enable certain GKs at runtime. We update the OSS gkx() implementation to refer to this property directly, and as a result we have to move the RecoilEnv to the shared package (which also conveniently ensures that RecoilEnv properties and gkx() are initialized together).
- Loading branch information
Showing
7 changed files
with
99 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
* @format | ||
* @oncall recoil | ||
*/ | ||
'use strict'; | ||
|
||
describe('RecoilEnv', () => { | ||
test('environment propagates GKs', () => { | ||
const RecoilEnv = require('../Recoil_RecoilEnv'); | ||
const gkx = require('../Recoil_gkx'); | ||
|
||
expect(gkx('recoil_test_gk')).toBe(false); | ||
RecoilEnv.RECOIL_GKS_ENABLED.add('recoil_test_gk'); | ||
expect(gkx('recoil_test_gk')).toBe(true); | ||
}); | ||
|
||
describe('support for process.env.RECOIL_GKS_ENABLED', () => { | ||
const originalProcessEnv = process.env; | ||
beforeEach(() => { | ||
process.env = {...originalProcessEnv}; | ||
process.env.RECOIL_GKS_ENABLED = | ||
'recoil_test_gk1,recoil_test_gk2 recoil_test_gk3'; | ||
jest.resetModules(); | ||
}); | ||
|
||
afterEach(() => { | ||
process.env = originalProcessEnv; | ||
}); | ||
|
||
test('environment propagates GKs', () => { | ||
const gkx = require('../Recoil_gkx'); | ||
|
||
expect(gkx('recoil_test_gk1')).toBe(true); | ||
expect(gkx('recoil_test_gk2')).toBe(true); | ||
expect(gkx('recoil_test_gk3')).toBe(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