2021-07-20 05:08:43 -04:00
|
|
|
import { mount } from '@vue/test-utils';
|
2022-03-14 05:08:52 -04:00
|
|
|
import TotalTime from '~/cycle_analytics/components/total_time.vue';
|
2017-10-06 04:29:24 -04:00
|
|
|
|
2022-03-14 05:08:52 -04:00
|
|
|
describe('TotalTime', () => {
|
2021-07-20 05:08:43 -04:00
|
|
|
let wrapper = null;
|
2017-10-06 04:29:24 -04:00
|
|
|
|
2021-03-24 14:09:31 -04:00
|
|
|
const createComponent = (propsData) => {
|
2022-03-14 05:08:52 -04:00
|
|
|
return mount(TotalTime, {
|
2021-03-24 14:09:31 -04:00
|
|
|
propsData,
|
|
|
|
});
|
|
|
|
};
|
2017-10-06 04:29:24 -04:00
|
|
|
|
|
|
|
afterEach(() => {
|
2021-03-24 14:09:31 -04:00
|
|
|
wrapper.destroy();
|
2017-10-06 04:29:24 -04:00
|
|
|
});
|
|
|
|
|
2021-07-20 05:08:43 -04:00
|
|
|
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,
|
2017-10-06 04:29:24 -04:00
|
|
|
});
|
|
|
|
|
2021-07-20 05:08:43 -04:00
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
2017-10-06 04:29:24 -04:00
|
|
|
});
|
2021-07-20 05:08:43 -04:00
|
|
|
});
|
2017-10-06 04:29:24 -04:00
|
|
|
|
2021-07-20 05:08:43 -04:00
|
|
|
describe('with a blank object', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
wrapper = createComponent({
|
|
|
|
time: {},
|
2017-10-06 04:29:24 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-07-20 05:08:43 -04:00
|
|
|
it('should render --', () => {
|
|
|
|
expect(wrapper.html()).toMatchSnapshot();
|
2017-10-06 04:29:24 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|