blob: 11ee2e56c14e55855eba9273602c5f81ebb01e0b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import { formatDate } from '~/lib/utils/datetime_utility';
import RichTimestampTooltip from '~/vue_shared/components/rich_timestamp_tooltip.vue';
describe('RichTimestampTooltip', () => {
const currentDate = new Date();
const mockRawTimestamp = currentDate.toISOString();
const mockTimestamp = formatDate(currentDate);
let wrapper;
const createComponent = ({
target = 'some-element',
rawTimestamp = mockRawTimestamp,
timestampTypeText = 'Created',
} = {}) => {
wrapper = shallowMountExtended(RichTimestampTooltip, {
propsData: {
target,
rawTimestamp,
timestampTypeText,
},
});
};
beforeEach(() => {
createComponent();
});
it('renders the tooltip text header', () => {
expect(wrapper.findByTestId('header-text').text()).toBe('Created just now');
});
it('renders the tooltip text body', () => {
expect(wrapper.findByTestId('body-text').text()).toBe(mockTimestamp);
});
});
|