debian-mirror-gitlab/spec/frontend/members/components/avatars/invite_avatar_spec.js

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

35 lines
870 B
JavaScript
Raw Normal View History

2021-01-03 14:25:43 +05:30
import { getByText as getByTextHelper } from '@testing-library/dom';
2021-03-11 19:13:27 +05:30
import { mount, createWrapper } from '@vue/test-utils';
2021-02-22 17:27:13 +05:30
import InviteAvatar from '~/members/components/avatars/invite_avatar.vue';
2021-03-11 19:13:27 +05:30
import { invite as member } from '../../mock_data';
2021-01-03 14:25:43 +05:30
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();
});
it('renders email as name', () => {
expect(getByText(invite.email).exists()).toBe(true);
});
it('renders avatar', () => {
expect(wrapper.find('img').attributes('src')).toBe(invite.avatarUrl);
});
});