8268933b56
Fixed web linter. Issue: https://github.com/storj/storj/issues/5158 Change-Id: Ia63e3e6e7352a99e902c9ed08a4bcfd75059e943
60 lines
1.9 KiB
TypeScript
60 lines
1.9 KiB
TypeScript
// Copyright (C) 2020 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
import Vuex from 'vuex';
|
|
import { createLocalVue, mount } from '@vue/test-utils';
|
|
|
|
import { newNotificationsModule } from '@/app/store/modules/notifications';
|
|
import { UINotification } from '@/app/types/notifications';
|
|
import { NotificationsHttpApi } from '@/storagenode/api/notifications';
|
|
import { Notification, NotificationTypes } from '@/storagenode/notifications/notifications';
|
|
import { NotificationsService } from '@/storagenode/notifications/service';
|
|
|
|
import SNONotification from '@/app/components/notifications/SNONotification.vue';
|
|
|
|
const localVue = createLocalVue();
|
|
localVue.use(Vuex);
|
|
|
|
const notificationsApi = new NotificationsHttpApi();
|
|
const notificationsService = new NotificationsService(notificationsApi);
|
|
const notificationsModule = newNotificationsModule(notificationsService);
|
|
|
|
const store = new Vuex.Store({ modules: { notificationsModule } });
|
|
|
|
describe('SNONotification', (): void => {
|
|
it('renders correctly with default props', (): void => {
|
|
const wrapper = mount(SNONotification, {
|
|
store,
|
|
localVue,
|
|
});
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
|
|
it('renders correctly', async (): Promise<void> => {
|
|
const note = new Notification(
|
|
'123',
|
|
'1234',
|
|
NotificationTypes.AuditCheckFailure,
|
|
'title1',
|
|
'message1',
|
|
);
|
|
const uinote = new UINotification(note);
|
|
|
|
const wrapper = mount(SNONotification, {
|
|
store,
|
|
localVue,
|
|
propsData: {
|
|
notification: uinote,
|
|
isSmall: false,
|
|
},
|
|
});
|
|
|
|
await wrapper.find('.notification-item').trigger('mouseenter');
|
|
|
|
// TODO: verify that the notification has been marked as read
|
|
// expect(state.notifications[0].isRead).toBe(true);
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
});
|