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

state_spec.js « store « edit « integrations « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5582be7fd3c6b6098054d3abcbb18feb3e9bb697 (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
import createState from '~/integrations/edit/store/state';

describe('Integration form state factory', () => {
  it('states default to null', () => {
    expect(createState()).toEqual({
      defaultState: null,
      customState: {},
      isSaving: false,
      isResetting: false,
      override: false,
      isLoadingJiraIssueTypes: false,
      jiraIssueTypes: [],
      loadingJiraIssueTypesErrorMessage: '',
    });
  });

  describe('override is initialized correctly', () => {
    it.each([
      [{ id: 25 }, { inheritFromId: null }, true],
      [{ id: 25 }, { inheritFromId: 27 }, true],
      [{ id: 25 }, { inheritFromId: 25 }, false],
      [null, { inheritFromId: null }, false],
      [null, { inheritFromId: 25 }, false],
    ])(
      'for defaultState: %p, customState: %p: override = `%p`',
      (defaultState, customState, expected) => {
        expect(createState({ defaultState, customState }).override).toEqual(expected);
      },
    );
  });
});