2019-08-09 12:38:23 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
import { mount } from '@vue/test-utils';
|
|
|
|
|
2019-10-28 15:59:19 +00:00
|
|
|
import TestList from '../mock/components/TestList.vue';
|
|
|
|
|
2019-08-09 12:38:23 +01:00
|
|
|
describe('TestList.vue', () => {
|
|
|
|
it('should render list of primitive types', function () {
|
|
|
|
const wrapper = mount(TestList, {
|
|
|
|
propsData: {
|
2022-04-07 12:04:24 +01:00
|
|
|
onItemClick: jest.fn(),
|
2019-09-13 15:58:18 +01:00
|
|
|
},
|
2019-08-09 12:38:23 +01:00
|
|
|
});
|
2019-08-19 12:20:38 +01:00
|
|
|
expect(wrapper).toMatchSnapshot();
|
2019-08-09 12:38:23 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should retrieve callback', function () {
|
2022-04-07 12:04:24 +01:00
|
|
|
const onPressSpy = jest.fn();
|
2019-08-09 12:38:23 +01:00
|
|
|
|
|
|
|
const wrapper = mount(TestList, {
|
|
|
|
propsData: {
|
|
|
|
onItemClick: onPressSpy,
|
2019-09-13 15:58:18 +01:00
|
|
|
},
|
2019-08-09 12:38:23 +01:00
|
|
|
});
|
|
|
|
wrapper.find('.item-component__item').trigger('click');
|
2022-04-07 12:04:24 +01:00
|
|
|
expect(onPressSpy).toHaveBeenCalledTimes(1);
|
2019-08-09 12:38:23 +01:00
|
|
|
});
|
|
|
|
});
|