gitlab-org--gitlab-foss/spec/frontend/cycle_analytics/limit_warning_component_spec.js

41 lines
959 B
JavaScript

import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import LimitWarningComponent from '~/cycle_analytics/components/limit_warning_component.vue';
import Translate from '~/vue_shared/translate';
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');
});
});