diff options
Diffstat (limited to 'spec/frontend/experimentation')
-rw-r--r-- | spec/frontend/experimentation/components/gitlab_experiment_spec.js (renamed from spec/frontend/experimentation/components/experiment_spec.js) | 2 | ||||
-rw-r--r-- | spec/frontend/experimentation/utils_spec.js | 20 |
2 files changed, 20 insertions, 2 deletions
diff --git a/spec/frontend/experimentation/components/experiment_spec.js b/spec/frontend/experimentation/components/gitlab_experiment_spec.js index dbc7da5c535..f52ebf0f3c4 100644 --- a/spec/frontend/experimentation/components/experiment_spec.js +++ b/spec/frontend/experimentation/components/gitlab_experiment_spec.js @@ -1,6 +1,6 @@ import { shallowMount } from '@vue/test-utils'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; -import ExperimentComponent from '~/experimentation/components/experiment.vue'; +import ExperimentComponent from '~/experimentation/components/gitlab_experiment.vue'; const defaultProps = { name: 'experiment_name' }; const defaultSlots = { diff --git a/spec/frontend/experimentation/utils_spec.js b/spec/frontend/experimentation/utils_spec.js index ec09bbab349..2ba8c65a252 100644 --- a/spec/frontend/experimentation/utils_spec.js +++ b/spec/frontend/experimentation/utils_spec.js @@ -1,5 +1,9 @@ import { assignGitlabExperiment } from 'helpers/experimentation_helper'; -import { DEFAULT_VARIANT, CANDIDATE_VARIANT } from '~/experimentation/constants'; +import { + DEFAULT_VARIANT, + CANDIDATE_VARIANT, + TRACKING_CONTEXT_SCHEMA, +} from '~/experimentation/constants'; import * as experimentUtils from '~/experimentation/utils'; describe('experiment Utilities', () => { @@ -19,6 +23,20 @@ describe('experiment Utilities', () => { }); }); + describe('getExperimentContexts', () => { + describe.each` + gon | input | output + ${[TEST_KEY, '_data_']} | ${[TEST_KEY]} | ${[{ schema: TRACKING_CONTEXT_SCHEMA, data: { variant: '_data_' } }]} + ${[]} | ${[TEST_KEY]} | ${[]} + `('with input=$input and gon=$gon', ({ gon, input, output }) => { + assignGitlabExperiment(...gon); + + it(`returns ${output}`, () => { + expect(experimentUtils.getExperimentContexts(...input)).toEqual(output); + }); + }); + }); + describe('isExperimentVariant', () => { describe.each` gon | input | output |