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

37 lines
816 B
TypeScript
Raw Normal View History

// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
import { mount, shallowMount } from '@vue/test-utils';
2018-11-16 14:28:02 +00:00
import AccountDropdown from '@/components/dashboard/account/AccountDropdown.vue';
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
});
});