debian-mirror-gitlab/spec/frontend/admin/users/index_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

62 lines
1.4 KiB
JavaScript
Raw Normal View History

2021-02-22 17:27:13 +05:30
import { createWrapper } from '@vue/test-utils';
2021-09-30 23:02:18 +05:30
import { initAdminUsersApp, initAdminUserActions } from '~/admin/users';
2021-02-22 17:27:13 +05:30
import AdminUsersApp from '~/admin/users/components/app.vue';
2021-09-30 23:02:18 +05:30
import UserActions from '~/admin/users/components/user_actions.vue';
import { users, user, paths } from './mock_data';
2021-02-22 17:27:13 +05:30
describe('initAdminUsersApp', () => {
let wrapper;
let el;
const findApp = () => wrapper.find(AdminUsersApp);
beforeEach(() => {
el = document.createElement('div');
2022-07-23 23:45:48 +05:30
el.dataset.users = JSON.stringify(users);
el.dataset.paths = JSON.stringify(paths);
2021-02-22 17:27:13 +05:30
2021-03-11 19:13:27 +05:30
wrapper = createWrapper(initAdminUsersApp(el));
2021-02-22 17:27:13 +05:30
});
afterEach(() => {
wrapper.destroy();
wrapper = null;
el = null;
});
it('parses and passes props', () => {
expect(findApp().props()).toMatchObject({
users,
paths,
});
});
});
2021-09-30 23:02:18 +05:30
describe('initAdminUserActions', () => {
let wrapper;
let el;
const findUserActions = () => wrapper.find(UserActions);
beforeEach(() => {
el = document.createElement('div');
2022-07-23 23:45:48 +05:30
el.dataset.user = JSON.stringify(user);
el.dataset.paths = JSON.stringify(paths);
2021-09-30 23:02:18 +05:30
wrapper = createWrapper(initAdminUserActions(el));
});
afterEach(() => {
wrapper.destroy();
wrapper = null;
el = null;
});
it('parses and passes props', () => {
expect(findUserActions().props()).toMatchObject({
user,
paths,
});
});
});