storj/web/satellite/tests/unit/dashboard/account/AccountDropdown.spec.ts
Bogdan Artemenko 8a79d184aa
[V3-965] Satellite account. Fixed Vue lint errors (#890)
* [V3-965] Satellite account. Fixed Vue lint errors
2018-12-18 16:43:23 +02:00

37 lines
816 B
TypeScript

// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
import { mount, shallowMount } from '@vue/test-utils';
import AccountDropdown from '@/components/dashboard/account/AccountDropdown.vue';
import * as sinon from 'sinon';
describe('AccountDropdown.vue', () => {
it('renders correctly', () => {
const wrapper = shallowMount(AccountDropdown);
expect(wrapper).toMatchSnapshot();
});
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');
expect(onCloseSpy.callCount).toBe(1);
expect(wrapper.emitted('onClose').length).toEqual(1);
});
});