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

app_spec.js « components « show « organizations « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 46496e40bdd7a2023b0bc921f87fed15bd15fa8d (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import App from '~/organizations/show/components/app.vue';
import OrganizationAvatar from '~/organizations/show/components/organization_avatar.vue';
import GroupsAndProjects from '~/organizations/show/components/groups_and_projects.vue';
import AssociationCount from '~/organizations/show/components/association_counts.vue';

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

  const defaultPropsData = {
    organization: {
      id: 1,
      name: 'GitLab',
    },
    associationCounts: {
      groups: 10,
      projects: 5,
      users: 6,
    },
    groupsAndProjectsOrganizationPath: '/-/organizations/default/groups_and_projects',
  };

  const createComponent = () => {
    wrapper = shallowMountExtended(App, { propsData: defaultPropsData });
  };

  beforeEach(() => {
    createComponent();
  });

  it('renders organization avatar and passes organization prop', () => {
    expect(wrapper.findComponent(OrganizationAvatar).props('organization')).toEqual(
      defaultPropsData.organization,
    );
  });

  it('renders groups and projects component and passes `groupsAndProjectsOrganizationPath` prop', () => {
    expect(
      wrapper.findComponent(GroupsAndProjects).props('groupsAndProjectsOrganizationPath'),
    ).toEqual(defaultPropsData.groupsAndProjectsOrganizationPath);
  });

  it('renders associations count component and passes expected props', () => {
    expect(wrapper.findComponent(AssociationCount).props()).toEqual({
      associationCounts: defaultPropsData.associationCounts,
      groupsAndProjectsOrganizationPath: defaultPropsData.groupsAndProjectsOrganizationPath,
    });
  });
});