2b78433cf0
fixed issue with required props that were not passed to component; added default props; related test added to ignored folder till vue 3 version update with vue-cli-service; Change-Id: Idc95a4c0b9f124797519652004abf53e066605c2
32 lines
924 B
TypeScript
32 lines
924 B
TypeScript
// Copyright (C) 2019 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
import { mount, shallowMount } from '@vue/test-utils';
|
|
|
|
import HeaderComponent from '@/components/common/VHeader.vue';
|
|
|
|
describe('HeaderComponent.vue', () => {
|
|
it('renders correctly', () => {
|
|
const wrapper = shallowMount<HeaderComponent>(HeaderComponent);
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
|
|
it('renders correctly with default props', () => {
|
|
const wrapper = mount<HeaderComponent>(HeaderComponent);
|
|
expect(wrapper.vm.$props.placeholder).toMatch('');
|
|
});
|
|
|
|
it('function clearSearch works correctly', () => {
|
|
const search = jest.fn();
|
|
|
|
const wrapper = mount<HeaderComponent>(HeaderComponent, {
|
|
propsData: {
|
|
search: search,
|
|
},
|
|
});
|
|
wrapper.vm.clearSearch();
|
|
expect(search).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|