blob: 9380e19c39ebf4080b9bfa789c67aef9f8f66206 (
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
|
import projects from 'test_fixtures/api/users/projects/get.json';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import ProjectsList from '~/vue_shared/components/projects_list/projects_list.vue';
import ProjectsListItem from '~/vue_shared/components/projects_list/projects_list_item.vue';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
describe('ProjectsList', () => {
let wrapper;
const defaultPropsData = {
projects: convertObjectPropsToCamelCase(projects, { deep: true }),
};
const createComponent = () => {
wrapper = shallowMountExtended(ProjectsList, {
propsData: defaultPropsData,
});
};
it('renders list with `ProjectListItem` component', () => {
createComponent();
const projectsListItemWrappers = wrapper.findAllComponents(ProjectsListItem).wrappers;
const expectedProps = projectsListItemWrappers.map((projectsListItemWrapper) =>
projectsListItemWrapper.props(),
);
expect(expectedProps).toEqual(
defaultPropsData.projects.map((project) => ({
project,
})),
);
});
});
|