debian-mirror-gitlab/spec/frontend/admin/users/components/user_date_spec.js
2021-03-11 19:13:27 +05:30

34 lines
728 B
JavaScript

import { shallowMount } from '@vue/test-utils';
import UserDate from '~/admin/users/components/user_date.vue';
import { users } from '../mock_data';
const mockDate = users[0].createdAt;
describe('FormatDate component', () => {
let wrapper;
const initComponent = (props = {}) => {
wrapper = shallowMount(UserDate, {
propsData: {
...props,
},
});
};
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
it.each`
date | output
${mockDate} | ${'13 Nov, 2020'}
${null} | ${'Never'}
${undefined} | ${'Never'}
`('renders $date as $output', ({ date, output }) => {
initComponent({ date });
expect(wrapper.text()).toBe(output);
});
});