summaryrefslogtreecommitdiff
path: root/spec/frontend/integrations/index/components/integrations_list_spec.js
blob: ee54a5fd3597327b34c799decc477110059733c3 (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 { shallowMountExtended } 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 = shallowMountExtended(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);
  });
});