storj/web/satellite/tests/unit/dashboard/account/AccountDropdown.spec.ts

37 lines
805 B
TypeScript
Raw Normal View History

2019-01-24 20:15:10 +00:00
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
import { mount, shallowMount } from '@vue/test-utils';
import AccountDropdown from '@/components/header/AccountDropdown.vue';
2018-11-16 14:28:02 +00:00
import * as sinon from 'sinon';
describe('AccountDropdown.vue', () => {
2018-11-16 14:28:02 +00:00
it('renders correctly', () => {
const wrapper = shallowMount(AccountDropdown);
2018-11-16 14:28:02 +00:00
expect(wrapper).toMatchSnapshot();
});
2018-11-16 14:28:02 +00:00
it('trigger onPress correctly', () => {
let onCloseSpy = sinon.spy();
const wrapper = mount(AccountDropdown, {
propsData: {
onClose: onCloseSpy
},
mocks: {
$router: {
push: onCloseSpy
}
}
});
wrapper.find('.adItemContainer.settings').trigger('click');
2018-11-16 14:28:02 +00:00
expect(onCloseSpy.callCount).toBe(1);
expect(wrapper.emitted('onClose').length).toEqual(1);
2018-11-16 14:28:02 +00:00
});
});