2019-08-09 12:19:49 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
2019-09-26 14:36:12 +01:00
|
|
|
import HeaderComponent from '@/components/common/VHeader.vue';
|
2019-08-09 12:19:49 +01:00
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
import { mount, shallowMount } from '@vue/test-utils';
|
|
|
|
|
2019-08-09 12:19:49 +01:00
|
|
|
describe('HeaderComponent.vue', () => {
|
|
|
|
it('renders correctly', () => {
|
2022-04-07 12:04:24 +01:00
|
|
|
const wrapper = shallowMount<HeaderComponent>(HeaderComponent);
|
2019-08-09 12:19:49 +01:00
|
|
|
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders correctly with default props', () => {
|
2022-04-07 12:04:24 +01:00
|
|
|
const wrapper = mount<HeaderComponent>(HeaderComponent);
|
2019-09-23 12:31:42 +01:00
|
|
|
expect(wrapper.vm.$props.placeholder).toMatch('');
|
2019-08-09 12:19:49 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
it('function clearSearch works correctly', () => {
|
2022-04-07 12:04:24 +01:00
|
|
|
const search = jest.fn();
|
2019-08-09 12:19:49 +01:00
|
|
|
|
2022-04-07 12:04:24 +01:00
|
|
|
const wrapper = mount<HeaderComponent>(HeaderComponent, {
|
|
|
|
propsData: {
|
|
|
|
search: search,
|
|
|
|
}
|
|
|
|
});
|
2019-08-09 12:19:49 +01:00
|
|
|
wrapper.vm.clearSearch();
|
2022-04-07 12:04:24 +01:00
|
|
|
expect(search).toHaveBeenCalledTimes(1);
|
2019-08-09 12:19:49 +01:00
|
|
|
});
|
|
|
|
});
|