2019-01-24 20:15:10 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
2018-12-12 13:44:01 +00:00
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
2018-12-18 14:43:23 +00:00
|
|
|
import { mount, shallowMount } from '@vue/test-utils';
|
2018-12-12 13:44:01 +00:00
|
|
|
import Notification from '@/components/notifications/Notification.vue';
|
|
|
|
import { NOTIFICATION_TYPES } from '@/utils/constants/notification';
|
|
|
|
|
|
|
|
describe('Notification.vue', () => {
|
2018-12-18 14:43:23 +00:00
|
|
|
|
2019-02-20 13:33:56 +00:00
|
|
|
it('renders correctly', () => {
|
|
|
|
const wrapper = shallowMount(Notification);
|
2018-12-12 13:44:01 +00:00
|
|
|
|
2019-02-20 13:33:56 +00:00
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
2018-12-12 13:44:01 +00:00
|
|
|
|
2019-02-20 13:33:56 +00:00
|
|
|
it('renders correctly with props', () => {
|
|
|
|
const testMessage = 'testMessage';
|
2018-12-12 13:44:01 +00:00
|
|
|
|
2019-02-20 13:33:56 +00:00
|
|
|
const wrapper = mount(Notification, {
|
|
|
|
propsData: {
|
|
|
|
type: NOTIFICATION_TYPES.SUCCESS,
|
|
|
|
message: testMessage,
|
|
|
|
},
|
|
|
|
});
|
2018-12-12 13:44:01 +00:00
|
|
|
|
2019-02-20 13:33:56 +00:00
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
expect(wrapper.find('.notification-wrap__text').text()).toMatch(testMessage);
|
2018-12-12 13:44:01 +00:00
|
|
|
|
2019-02-20 13:33:56 +00:00
|
|
|
wrapper.setProps({
|
|
|
|
type: NOTIFICATION_TYPES.ERROR,
|
|
|
|
message: testMessage,
|
|
|
|
});
|
2018-12-12 13:44:01 +00:00
|
|
|
|
2019-02-20 13:33:56 +00:00
|
|
|
expect(wrapper).toMatchSnapshot();
|
2018-12-12 13:44:01 +00:00
|
|
|
|
2019-02-20 13:33:56 +00:00
|
|
|
wrapper.setProps({
|
|
|
|
type: NOTIFICATION_TYPES.NOTIFICATION,
|
|
|
|
message: testMessage,
|
|
|
|
});
|
2018-12-12 13:44:01 +00:00
|
|
|
|
2019-02-20 13:33:56 +00:00
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
2018-12-12 13:44:01 +00:00
|
|
|
});
|