empty_chart_spec.js 806 Bytes
Newer Older
1
import { shallowMount, createLocalVue } from '@vue/test-utils';
2 3
import EmptyChart from '~/monitoring/components/charts/empty_chart.vue';

4 5
const localVue = createLocalVue();

6 7 8 9 10
describe('Empty Chart component', () => {
  let emptyChart;
  const graphTitle = 'Memory Usage';

  beforeEach(() => {
11
    emptyChart = shallowMount(localVue.extend(EmptyChart), {
12 13 14
      propsData: {
        graphTitle,
      },
15 16
      sync: false,
      localVue,
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    });
  });

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

  it('render the chart title', () => {
    expect(emptyChart.find({ ref: 'graphTitle' }).text()).toBe(graphTitle);
  });

  describe('Computed props', () => {
    it('sets the height for the svg container', () => {
      expect(emptyChart.vm.svgContainerStyle.height).toBe('300px');
    });
  });
});