storj/web/storagenode/tests/unit/components/notifications/NotificationArea.spec.ts
Vitalii 8268933b56 web/storagenode: fix linter
Fixed web linter.

Issue:
https://github.com/storj/storj/issues/5158

Change-Id: Ia63e3e6e7352a99e902c9ed08a4bcfd75059e943
2022-11-04 18:32:26 +00:00

50 lines
1.7 KiB
TypeScript

// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
import Router from 'vue-router';
import Vuex from 'vuex';
import { createLocalVue, shallowMount } from '@vue/test-utils';
import { newNotificationsModule, NOTIFICATIONS_MUTATIONS } from '@/app/store/modules/notifications';
import { NotificationsState, UINotification } from '@/app/types/notifications';
import NotificationsArea from '@/app/views/NotificationsArea.vue';
import { NotificationsHttpApi } from '@/storagenode/api/notifications';
import { Notification } from '@/storagenode/notifications/notifications';
import { NotificationsService } from '@/storagenode/notifications/service';
const localVue = createLocalVue();
localVue.use(Vuex);
localVue.use(Router);
const notificationsApi = new NotificationsHttpApi();
const notificationsService = new NotificationsService(notificationsApi);
const notificationsModule = newNotificationsModule(notificationsService);
const store = new Vuex.Store({ modules: { notificationsModule } });
describe('NotificationsArea', (): void => {
it('renders correctly with no notifications', (): void => {
const wrapper = shallowMount(NotificationsArea, {
store,
localVue,
});
expect(wrapper).toMatchSnapshot();
});
it('renders correctly with notifications', async (): Promise<void> => {
await store.commit(NOTIFICATIONS_MUTATIONS.SET_NOTIFICATIONS, new NotificationsState(
[new UINotification(new Notification())],
1,
1,
));
const wrapper = shallowMount(NotificationsArea, {
store,
localVue,
});
expect(wrapper).toMatchSnapshot();
});
});