storj/web/satellite/tests/unit/apiKeys/ApiKeysCopyPopup.spec.ts
VitaliiShpital 6bf40f3e59 web/satellite: npm packages updated
Change-Id: I87c1507423817283047d70d0d741307e03905556
2020-01-13 18:08:32 +00:00

45 lines
1.3 KiB
TypeScript

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
import Vuex from 'vuex';
import ApiKeysCopyPopup from '@/components/apiKeys/ApiKeysCopyPopup.vue';
import { ApiKeysApiGql } from '@/api/apiKeys';
import { makeApiKeysModule } from '@/store/modules/apiKeys';
import { makeNotificationsModule } from '@/store/modules/notifications';
import { NotificatorPlugin } from '@/utils/plugins/notificator';
import { createLocalVue, mount } from '@vue/test-utils';
const localVue = createLocalVue();
localVue.use(Vuex);
const notificationPlugin = new NotificatorPlugin();
localVue.use(notificationPlugin);
const apiKeysApi = new ApiKeysApiGql();
const apiKeysModule = makeApiKeysModule(apiKeysApi);
const notificationsModule = makeNotificationsModule();
const store = new Vuex.Store({ modules: { notificationsModule, apiKeysModule }});
describe('ApiKeysCopyPopup', () => {
it('renders correctly', () => {
const wrapper = mount(ApiKeysCopyPopup, {
store,
localVue,
});
expect(wrapper).toMatchSnapshot();
});
it('function onCloseClick works correctly', async () => {
const wrapper = mount(ApiKeysCopyPopup, {
store,
localVue,
});
await wrapper.vm.onCloseClick();
expect(wrapper.emitted()).toEqual({'closePopup': [[]]});
});
});