debian-mirror-gitlab/spec/frontend/members/components/avatars/invite_avatar_spec.js
2021-02-22 17:27:13 +05:30

38 lines
920 B
JavaScript

import { mount, createWrapper } from '@vue/test-utils';
import { getByText as getByTextHelper } from '@testing-library/dom';
import { invite as member } from '../../mock_data';
import InviteAvatar from '~/members/components/avatars/invite_avatar.vue';
describe('MemberList', () => {
let wrapper;
const { invite } = member;
const createComponent = (propsData = {}) => {
wrapper = mount(InviteAvatar, {
propsData: {
member,
...propsData,
},
});
};
const getByText = (text, options) =>
createWrapper(getByTextHelper(wrapper.element, text, options));
beforeEach(() => {
createComponent();
});
afterEach(() => {
wrapper.destroy();
});
it('renders email as name', () => {
expect(getByText(invite.email).exists()).toBe(true);
});
it('renders avatar', () => {
expect(wrapper.find('img').attributes('src')).toBe(invite.avatarUrl);
});
});