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

csv_viewer_spec.js « blob_viewers « components « repository « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c6b9737dde20118f9ddfee61868fd2c91b7aefe5 (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
import { shallowMount } from '@vue/test-utils';
import CsvViewer from '~/repository/components/blob_viewers/csv_viewer.vue';

describe('CSV Viewer', () => {
  let wrapper;

  const DEFAULT_BLOB_DATA = {
    rawPath: 'some/file.csv',
    name: 'file.csv',
  };

  const createComponent = () => {
    wrapper = shallowMount(CsvViewer, {
      propsData: { blob: DEFAULT_BLOB_DATA },
      stubs: ['CsvViewer'],
    });
  };

  const findCsvViewerComp = () => wrapper.find('[data-testid="csv"]');

  it('renders a Source Editor component', () => {
    createComponent();
    expect(findCsvViewerComp().exists()).toBe(true);
    expect(findCsvViewerComp().props('remoteFile')).toBe(true);
    expect(findCsvViewerComp().props('csv')).toBe(DEFAULT_BLOB_DATA.rawPath);
  });
});