import $ from 'jquery'; import * as notify from '@/js/notify'; test('show message', () => { document.body.innerHTML = '
'; notify.showMsg('hi'); const element = $('#msg'); expect(element.hasClass('callout')).toBeTrue(); expect(element.hasClass('callout-info')).toBeTrue(); expect(element.html()).toBe('hi'); }); test('show AJAX error', () => { notify.showAjaxError(); // Can be no arguments $.fn.modal = function () { document.body.innerHTML = this.html(); }; notify.showAjaxError('error\nerror'); expect(document.body.innerHTML).toContain('error