storj/web/satellite/tests/unit/common/TestList.spec.ts

32 lines
841 B
TypeScript
Raw Normal View History

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