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

getters_spec.js « artifacts_list « stores « vue_mr_widget « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 62ee6f5f189052740fb5d84c7fd8e15d812aee8d (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
import { title } from '~/vue_merge_request_widget/stores/artifacts_list/getters';
import state from '~/vue_merge_request_widget/stores/artifacts_list/state';
import { artifactsList } from '../../components/mock_data';

describe('Artifacts Store Getters', () => {
  let localState;

  beforeEach(() => {
    localState = state();
  });

  describe('title', () => {
    describe('when is loading', () => {
      it('returns loading message', () => {
        localState.isLoading = true;
        expect(title(localState)).toBe('Loading artifacts');
      });
    });
    describe('when has error', () => {
      it('returns error message', () => {
        localState.hasError = true;
        expect(title(localState)).toBe('An error occurred while fetching the artifacts');
      });
    });
    describe('when it has artifacts', () => {
      it('returns artifacts message', () => {
        localState.artifacts = artifactsList;
        expect(title(localState)).toBe('View 2 exposed artifacts');
      });
    });
  });
});