BigW Consortium Gitlab

limit_warning_component_spec.js 1004 Bytes
Newer Older
1
import Vue from 'vue';
2
import Translate from '~/vue_shared/translate';
3
import limitWarningComp from '~/cycle_analytics/components/limit_warning_component.vue';
4

5 6
Vue.use(Translate);

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 42
describe('Limit warning component', () => {
  let component;
  let LimitWarningComponent;

  beforeEach(() => {
    LimitWarningComponent = Vue.extend(limitWarningComp);
  });

  it('should not render if count is not exactly than 50', () => {
    component = new LimitWarningComponent({
      propsData: {
        count: 5,
      },
    }).$mount();

    expect(component.$el.textContent.trim()).toBe('');

    component = new LimitWarningComponent({
      propsData: {
        count: 55,
      },
    }).$mount();

    expect(component.$el.textContent.trim()).toBe('');
  });

  it('should render if count is exactly 50', () => {
    component = new LimitWarningComponent({
      propsData: {
        count: 50,
      },
    }).$mount();

    expect(component.$el.textContent.trim()).toBe('Showing 50 events');
  });
});