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

alert_spec.js « mutations « stores « ide « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2840ec4ebb70e14f57201cbb302b4cb0e6df2f87 (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
import * as types from '~/ide/stores/mutation_types';
import mutations from '~/ide/stores/mutations/alert';

describe('~/ide/stores/mutations/alert', () => {
  const state = {};

  describe(types.DETECT_ENVIRONMENTS_GUIDANCE_ALERT, () => {
    it('checks the stages for any that configure environments', () => {
      mutations[types.DETECT_ENVIRONMENTS_GUIDANCE_ALERT](state, {
        nodes: [{ groups: { nodes: [{ jobs: { nodes: [{}] } }] } }],
      });
      expect(state.environmentsGuidanceAlertDetected).toBe(true);
      mutations[types.DETECT_ENVIRONMENTS_GUIDANCE_ALERT](state, {
        nodes: [{ groups: { nodes: [{ jobs: { nodes: [{ environment: {} }] } }] } }],
      });
      expect(state.environmentsGuidanceAlertDetected).toBe(false);
    });
  });

  describe(types.DISMISS_ENVIRONMENTS_GUIDANCE_ALERT, () => {
    it('stops environments guidance', () => {
      mutations[types.DISMISS_ENVIRONMENTS_GUIDANCE_ALERT](state);
      expect(state.environmentsGuidanceAlertDismissed).toBe(true);
    });
  });
});