storj/web/satellite/tests/unit/notifications/NotificationArea.spec.ts

50 lines
1.4 KiB
TypeScript
Raw Normal View History

2019-01-24 20:15:10 +00:00
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
import NotificationArea from '@/components/notifications/NotificationArea.vue';
2019-09-09 11:33:39 +01:00
import { DelayedNotification } from '@/types/DelayedNotification';
2019-09-09 11:33:39 +01:00
import { NOTIFICATION_TYPES } from '@/utils/constants/notification';
import { mount, shallowMount } from '@vue/test-utils';
describe('NotificationArea.vue', () => {
it('renders correctly', () => {
const wrapper = shallowMount(NotificationArea, {
computed: {
notifications: () => [],
},
});
expect(wrapper).toMatchSnapshot();
});
it('renders correctly with notification', () => {
const testMessage = 'testMessage';
const notifications = [new DelayedNotification(
jest.fn(),
NOTIFICATION_TYPES.SUCCESS,
testMessage,
), new DelayedNotification(
jest.fn(),
NOTIFICATION_TYPES.ERROR,
testMessage,
), new DelayedNotification(
jest.fn(),
NOTIFICATION_TYPES.WARNING,
testMessage,
), new DelayedNotification(
jest.fn(),
NOTIFICATION_TYPES.NOTIFICATION,
testMessage,
)];
const wrapper = mount(NotificationArea, {
computed: {
notifications: () => notifications,
},
});
expect(wrapper).toMatchSnapshot();
});
});