storj/web/satellite/tests/unit/components/header/AccountDropdown.spec.ts
Egon Elbre 6b153192a3 web/satellite: fix lint issues
After migrating to eslint some errors were disabled to make it easier to
migrate.

This enables all the lint rules and treats all warnings as a build
failure. Similarly, CI won't automatically try to fix mistakes.

Change-Id: I80f808af026fc51bed90421b3b24737994a52094
2021-08-10 09:22:19 +00:00

44 lines
1.1 KiB
TypeScript

// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
import sinon from 'sinon';
import Vuex from 'vuex';
import AccountDropdown from '@/components/header/accountDropdown/AccountDropdown.vue';
import { router } from '@/router';
import { appStateModule } from '@/store/modules/appState';
import { createLocalVue, mount } from '@vue/test-utils';
const localVue = createLocalVue();
localVue.use(Vuex);
const store = new Vuex.Store({ modules: { appStateModule }});
describe('AccountDropdown', () => {
it('renders correctly', (): void => {
const wrapper = mount(AccountDropdown, {
store,
localVue,
router,
});
expect(wrapper).toMatchSnapshot();
});
it('router works correctly', async (): Promise<void> => {
const routerSpy = sinon.spy();
const wrapper = mount(AccountDropdown, {
store,
localVue,
router,
});
wrapper.vm.onLogoutClick = routerSpy;
await wrapper.find('.account-dropdown__wrap__item-container').trigger('click');
expect(routerSpy.callCount).toBe(1);
});
});