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

36 lines
952 B
TypeScript
Raw Normal View History

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
import * as sinon from 'sinon';
2019-09-09 11:33:39 +01:00
import HeaderComponent from '@/components/common/VHeader.vue';
2019-09-09 11:33:39 +01:00
import { mount, shallowMount } from '@vue/test-utils';
describe('HeaderComponent.vue', () => {
it('renders correctly', () => {
const wrapper = shallowMount(HeaderComponent);
expect(wrapper).toMatchSnapshot();
});
it('renders correctly with default props', () => {
const wrapper = mount(HeaderComponent);
expect(wrapper.vm.$props.placeholder).toMatch('');
expect(wrapper.vm.$props.search).toMatch('');
});
it('function clearSearch works correctly', () => {
2019-09-09 11:33:39 +01:00
const clearSearchSpy = sinon.spy();
const wrapper = mount(HeaderComponent);
wrapper.vm.$refs.search.clearSearch = clearSearchSpy;
wrapper.vm.clearSearch();
expect(clearSearchSpy.callCount).toBe(1);
});
});