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

integrations_list_spec.js « components « index « integrations « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 94fd7fc84ee7336b9e88839dd58a0c551826b86e (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
import { shallowMount } from '@vue/test-utils';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import IntegrationsList from '~/integrations/index/components/integrations_list.vue';
import { mockActiveIntegrations, mockInactiveIntegrations } from '../mock_data';

describe('IntegrationsList', () => {
  let wrapper;

  const findActiveIntegrationsTable = () => wrapper.findByTestId('active-integrations-table');
  const findInactiveIntegrationsTable = () => wrapper.findByTestId('inactive-integrations-table');

  const createComponent = (propsData = {}) => {
    wrapper = extendedWrapper(shallowMount(IntegrationsList, { propsData }));
  };

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

  it('provides correct `integrations` prop to the IntegrationsTable instance', () => {
    createComponent({ integrations: [...mockInactiveIntegrations, ...mockActiveIntegrations] });

    expect(findActiveIntegrationsTable().props('integrations')).toEqual(mockActiveIntegrations);
    expect(findInactiveIntegrationsTable().props('integrations')).toEqual(mockInactiveIntegrations);
  });
});