storj/web/satellite/tests/unit/ignore/common/VHeader.spec.ts

32 lines
924 B
TypeScript
Raw Normal View History

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
2019-09-09 11:33:39 +01:00
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);
});
});