diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 17:36:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 17:36:54 +0300 |
commit | f61bb2a16a514b71bf33aabbbb999d6732016a24 (patch) | |
tree | 9548caa89e60b4f40b99bbd1dac030420b812aa8 /spec/frontend/__helpers__/experimentation_helper.js | |
parent | 35fc54e5d261f8898e390aea7c2f5ec5fdf0539d (diff) |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc42
Diffstat (limited to 'spec/frontend/__helpers__/experimentation_helper.js')
-rw-r--r-- | spec/frontend/__helpers__/experimentation_helper.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/frontend/__helpers__/experimentation_helper.js b/spec/frontend/__helpers__/experimentation_helper.js index c08c25155e8..7a2ef61216a 100644 --- a/spec/frontend/__helpers__/experimentation_helper.js +++ b/spec/frontend/__helpers__/experimentation_helper.js @@ -12,3 +12,16 @@ export function withGonExperiment(experimentKey, value = true) { window.gon = origGon; }); } +// This helper is for specs that use `gitlab-experiment` utilities, which have a different schema that gets pushed via Gon compared to `Experimentation Module` +export function assignGitlabExperiment(experimentKey, variant) { + let origGon; + + beforeEach(() => { + origGon = window.gon; + window.gon = { experiment: { [experimentKey]: { variant } } }; + }); + + afterEach(() => { + window.gon = origGon; + }); +} |