summaryrefslogtreecommitdiff
path: root/spec/frontend/registry/explorer/stores/getters_spec.js
blob: c224f076d3095affca81c9795f6ca1f1fec06642 (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
import * as getters from '~/registry/explorer/stores/getters';

describe('Getters RegistryExplorer  store', () => {
  let state;
  const tags = ['foo', 'bar'];

  describe('tags', () => {
    describe('when isLoading is false', () => {
      beforeEach(() => {
        state = {
          tags,
          isLoading: false,
        };
      });

      it('returns tags', () => {
        expect(getters.tags(state)).toEqual(state.tags);
      });
    });

    describe('when isLoading is true', () => {
      beforeEach(() => {
        state = {
          tags,
          isLoading: true,
        };
      });

      it('returns empty array', () => {
        expect(getters.tags(state)).toEqual([]);
      });
    });
  });
});