diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-22 21:09:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-22 21:09:10 +0300 |
commit | 852877d997ee2b22f185d388992382986a8f2e1d (patch) | |
tree | 2fe0263ec73d5d902a90a3fc798983d5b7bea332 /spec/frontend/admin/users/components/user_date_spec.js | |
parent | 7e81076708c00325c922928aa593070b1c9b402c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/admin/users/components/user_date_spec.js')
-rw-r--r-- | spec/frontend/admin/users/components/user_date_spec.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/frontend/admin/users/components/user_date_spec.js b/spec/frontend/admin/users/components/user_date_spec.js new file mode 100644 index 00000000000..6428b10059b --- /dev/null +++ b/spec/frontend/admin/users/components/user_date_spec.js @@ -0,0 +1,34 @@ +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); + }); +}); |