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

runner_online_stat_spec.js « stat « components « runner « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 18f865aa22c1addf85d98cfbf6545080c9c2f38c (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 { GlSingleStat } from '@gitlab/ui/dist/charts';
import { shallowMount, mount } from '@vue/test-utils';
import RunnerOnlineBadge from '~/runner/components/stat/runner_online_stat.vue';

describe('RunnerOnlineBadge', () => {
  let wrapper;

  const findSingleStat = () => wrapper.findComponent(GlSingleStat);

  const createComponent = ({ props = {} } = {}, mountFn = shallowMount) => {
    wrapper = mountFn(RunnerOnlineBadge, {
      propsData: {
        value: '99',
        ...props,
      },
    });
  };

  afterEach(() => {
    wrapper.destroy();
  });

  it('Uses a success appearance', () => {
    createComponent({}, shallowMount);

    expect(findSingleStat().props('variant')).toBe('success');
  });

  it('Renders a value', () => {
    createComponent({}, mount);

    expect(wrapper.text()).toMatch(new RegExp(`Online Runners 99\\s+online`));
  });
});