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

limit_warning_component_spec.js « cycle_analytics « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: edde3725dd6699ec73f06253c58436862bdeb622 (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
35
36
37
38
39
40
41
import Vue from 'vue';
import { shallowMount } from '@vue/test-utils';
import Translate from '~/vue_shared/translate';
import LimitWarningComponent from '~/cycle_analytics/components/limit_warning_component.vue';

Vue.use(Translate);

const createComponent = (props) =>
  shallowMount(LimitWarningComponent, {
    propsData: {
      ...props,
    },
  });

describe('Limit warning component', () => {
  let component;

  beforeEach(() => {
    component = null;
  });

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

  it('should not render if count is not exactly than 50', () => {
    component = createComponent({ count: 5 });

    expect(component.text().trim()).toBe('');

    component = createComponent({ count: 55 });

    expect(component.text().trim()).toBe('');
  });

  it('should render if count is exactly 50', () => {
    component = createComponent({ count: 50 });

    expect(component.text().trim()).toBe('Showing 50 events');
  });
});