summaryrefslogtreecommitdiff
path: root/spec/frontend/pages/projects/forks/new/components/app_spec.js
blob: a7b4b9c42bd5cba2fbc9d04a67f7234f9913c9ec (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
import { shallowMount } from '@vue/test-utils';
import App from '~/pages/projects/forks/new/components/app.vue';

describe('App component', () => {
  let wrapper;

  const DEFAULT_PROPS = {
    forkIllustration: 'illustrations/project-create-new-sm.svg',
    endpoint: '/some/project-full-path/-/forks/new.json',
    projectFullPath: '/some/project-full-path',
    projectId: '10',
    projectName: 'Project Name',
    projectPath: 'project-name',
    projectDescription: 'some project description',
    projectVisibility: 'private',
    restrictedVisibilityLevels: [],
  };

  const createComponent = (props = {}) => {
    wrapper = shallowMount(App, {
      propsData: {
        ...DEFAULT_PROPS,
        ...props,
      },
    });
  };

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

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

  it('displays the correct svg illustration', () => {
    expect(wrapper.find('img').attributes('src')).toBe('illustrations/project-create-new-sm.svg');
  });

  it('renders ForkForm component with prop', () => {
    expect(wrapper.props()).toEqual(expect.objectContaining(DEFAULT_PROPS));
  });
});