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

gl_feature_flags_mixin_spec.js « mixins « vue_shared « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a3e3270a4e85c6b3b0fab40d103ac391d1182900 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { createLocalVue, shallowMount } from '@vue/test-utils';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';

const localVue = createLocalVue();

describe('GitLab Feature Flags Mixin', () => {
  let wrapper;

  beforeEach(() => {
    const gon = {
      features: {
        aFeature: true,
        bFeature: false,
      },
    };

    const component = {
      template: `<span></span>`,
      mixins: [glFeatureFlagsMixin()],
    };

    wrapper = shallowMount(component, {
      localVue,
      provide: {
        glFeatures: { ...(gon.features || {}) },
      },
    });
  });

  it('should provide glFeatures to components', () => {
    expect(wrapper.vm.glFeatures).toEqual({
      aFeature: true,
      bFeature: false,
    });
  });
});