2021-10-27 15:23:28 +05:30
|
|
|
import { mount } from '@vue/test-utils';
|
2023-03-04 22:38:38 +05:30
|
|
|
import TotalTime from '~/analytics/cycle_analytics/components/total_time.vue';
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2022-05-07 20:08:51 +05:30
|
|
|
describe('TotalTime', () => {
|
2021-10-27 15:23:28 +05:30
|
|
|
let wrapper = null;
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
const createComponent = (propsData) => {
|
2022-05-07 20:08:51 +05:30
|
|
|
return mount(TotalTime, {
|
2021-04-29 21:17:54 +05:30
|
|
|
propsData,
|
|
|
|
});
|
|
|
|
};
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
afterEach(() => {
|
2021-04-29 21:17:54 +05:30
|
|
|
wrapper.destroy();
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
describe('with a valid time object', () => {
|
|
|
|
it.each`
|
|
|
|
time
|
|
|
|
${{ seconds: 35 }}
|
|
|
|
${{ mins: 47, seconds: 3 }}
|
|
|
|
${{ days: 3, mins: 47, seconds: 3 }}
|
|
|
|
${{ hours: 23, mins: 10 }}
|
|
|
|
${{ hours: 7, mins: 20, seconds: 10 }}
|
|
|
|
`('with $time', ({ time }) => {
|
|
|
|
wrapper = createComponent({
|
|
|
|
time,
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
2021-10-27 15:23:28 +05:30
|
|
|
});
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
describe('with a blank object', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
wrapper = createComponent({
|
|
|
|
time: {},
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
it('should render --', () => {
|
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|