cartodb-4.42/lib/assets/test/spec/new-dashboard/unit/specs/components/NotificationWarning.spec.js
2024-04-06 05:25:13 +00:00

43 lines
1.0 KiB
JavaScript

import { createLocalVue, shallowMount } from '@vue/test-utils';
import Vuex from 'vuex';
import NotificationWarning from 'new-dashboard/components/NotificationWarning';
const localVue = createLocalVue();
localVue.use(Vuex);
describe('NotificationWarning.vue', () => {
let notificationWarning;
const $store = {
dispatch: jest.fn()
};
notificationWarning = shallowMount(NotificationWarning, {
propsData: {
htmlBody: 'Notification message'
},
localVue,
mocks: {
$store
}
});
beforeEach(() => {
notificationWarning.setProps({
htmlBody: 'Notification message'
});
});
describe('basic behaviour', () => {
it('should render the body', () => {
expect(notificationWarning).toMatchSnapshot();
});
it('should call the close method when clicking on close button', () => {
notificationWarning.find('button.notification__close-button').trigger('click');
expect($store.dispatch).toHaveBeenCalledWith('user/hideUserNotification');
});
});
});