summaryrefslogtreecommitdiff
path: root/spec/frontend/experimentation
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-19 15:44:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-19 15:44:42 +0000
commit4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch)
tree5423a1c7516cffe36384133ade12572cf709398d /spec/frontend/experimentation
parente570267f2f6b326480d284e0164a6464ba4081bc (diff)
downloadgitlab-ce-4555e1b21c365ed8303ffb7a3325d773c9b8bf31.tar.gz
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
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.js20
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