Welcome to mirror list, hosted at ThFree Co, Russian Federation.

experimentation_spec.js « utils « lib « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2c5d2f89297d57fa93a5159f3593b4812e84db88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import * as experimentUtils from '~/lib/utils/experimentation';

const TEST_KEY = 'abc';

describe('experiment Utilities', () => {
  describe('isExperimentEnabled', () => {
    it.each`
      experiments              | value
      ${{ [TEST_KEY]: true }}  | ${true}
      ${{ [TEST_KEY]: false }} | ${false}
      ${{ def: true }}         | ${false}
      ${{}}                    | ${false}
      ${null}                  | ${false}
    `('returns correct value of $value for experiments=$experiments', ({ experiments, value }) => {
      window.gon = { experiments };

      expect(experimentUtils.isExperimentEnabled(TEST_KEY)).toEqual(value);
    });
  });
});