2019-08-09 12:38:23 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
import { mount } from '@vue/test-utils';
|
|
|
|
import TestList from '@/components/common/test/TestList.vue';
|
2019-08-19 12:20:38 +01:00
|
|
|
import sinon from 'sinon';
|
2019-08-09 12:38:23 +01:00
|
|
|
|
|
|
|
describe('TestList.vue', () => {
|
|
|
|
it('should render list of primitive types', function () {
|
|
|
|
const wrapper = mount(TestList, {
|
|
|
|
propsData: {
|
|
|
|
onItemClick: sinon.stub()
|
|
|
|
}
|
|
|
|
});
|
2019-08-19 12:20:38 +01:00
|
|
|
expect(wrapper).toMatchSnapshot();
|
2019-08-09 12:38:23 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should retrieve callback', function () {
|
|
|
|
let onPressSpy = sinon.spy();
|
|
|
|
|
|
|
|
const wrapper = mount(TestList, {
|
|
|
|
propsData: {
|
|
|
|
onItemClick: onPressSpy,
|
|
|
|
}
|
|
|
|
});
|
|
|
|
wrapper.find('.item-component__item').trigger('click');
|
|
|
|
expect(onPressSpy.callCount).toBe(1);
|
|
|
|
});
|
|
|
|
});
|