summaryrefslogtreecommitdiff
path: root/spec/frontend/admin/users/components/app_spec.js
blob: 65b13e3a40d7d1b11dd3b83afc6a181ab52257f3 (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
import { shallowMount } from '@vue/test-utils';

import AdminUsersApp from '~/admin/users/components/app.vue';
import AdminUsersTable from '~/admin/users/components/users_table.vue';
import { users, paths } from '../mock_data';

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

  const initComponent = (props = {}) => {
    wrapper = shallowMount(AdminUsersApp, {
      propsData: {
        users,
        paths,
        ...props,
      },
    });
  };

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

  describe('when initialized', () => {
    beforeEach(() => {
      initComponent();
    });

    it('renders the admin users table with props', () => {
      expect(wrapper.find(AdminUsersTable).props()).toEqual({
        users,
        paths,
      });
    });
  });
});