diff --git a/resources/assets/src/js/__tests__/admin.test.js b/resources/assets/src/js/__tests__/admin.test.js index 9fa43f37..d59bbf11 100644 --- a/resources/assets/src/js/__tests__/admin.test.js +++ b/resources/assets/src/js/__tests__/admin.test.js @@ -8,6 +8,7 @@ describe('tests for "customize" module', () => { it('change skin preview after switching color', () => { window.current_skin = 'skin-blue'; + window.showAjaxError = jest.fn(); document.body.className = window.current_skin; document.body.innerHTML = `
@@ -35,6 +36,7 @@ describe('tests for "customize" module', () => { window.url = url; window.toastr = toastr; window.current_skin = ''; + window.showAjaxError = jest.fn(); document.body.innerHTML = ''; const submitColor = require(modulePath); @@ -69,6 +71,7 @@ describe('tests for "players" module', () => { window.fetch = fetch; window.url = url; window.toastr = toastr; + window.showAjaxError = jest.fn(); document.body.innerHTML = `
@@ -111,6 +114,7 @@ describe('tests for "players" module', () => { window.url = url; window.toastr = toastr; window.$.fn.modal = modal; + window.showAjaxError = jest.fn(); document.body.innerHTML = ` @@ -157,6 +161,7 @@ describe('tests for "players" module', () => { window.toastr = toastr; window.trans = trans; window.swal = swal; + window.showAjaxError = jest.fn(); document.body.innerHTML = ` @@ -208,6 +213,7 @@ describe('tests for "players" module', () => { window.trans = trans; window.swal = swal; window.debounce = debounce; + window.showAjaxError = jest.fn(); document.body.innerHTML = `
@@ -263,6 +269,7 @@ describe('tests for "players" module', () => { window.toastr = toastr; window.trans = trans; window.swal = swal; + window.showAjaxError = jest.fn(); document.body.innerHTML = `
@@ -310,6 +317,7 @@ describe('tests for "plugins" module', () => { window.fetch = fetch; window.url = url; window.toastr = toastr; + window.showAjaxError = jest.fn(); $.pluginsTable = { ajax: { reload: reloadTable @@ -345,6 +353,7 @@ describe('tests for "plugins" module', () => { window.fetch = fetch; window.url = url; window.toastr = toastr; + window.showAjaxError = jest.fn(); $.pluginsTable = { ajax: { reload: reloadTable @@ -380,6 +389,7 @@ describe('tests for "plugins" module', () => { window.fetch = fetch; window.url = url; window.toastr = toastr; + window.showAjaxError = jest.fn(); $.pluginsTable = { ajax: { reload: reloadTable @@ -423,6 +433,7 @@ describe('tests for "update" module', () => { window.fetch = fetch; window.url = url; window.toastr = toastr; + window.showAjaxError = jest.fn(); $.fn.modal = modal; document.body.innerHTML = ` @@ -470,6 +481,7 @@ describe('tests for "users" module', () => { window.toastr = toastr; window.trans = trans; window.swal = swal; + window.showAjaxError = jest.fn(); document.body.innerHTML = `
@@ -519,6 +531,7 @@ describe('tests for "users" module', () => { window.toastr = toastr; window.trans = trans; window.swal = swal; + window.showAjaxError = jest.fn(); document.body.innerHTML = `
@@ -566,6 +579,7 @@ describe('tests for "users" module', () => { window.toastr = toastr; window.trans = trans; window.swal = swal; + window.showAjaxError = jest.fn(); const changeUserPwd = require(modulePath).changeUserPwd; @@ -597,6 +611,7 @@ describe('tests for "users" module', () => { window.fetch = fetch; window.url = url; window.toastr = toastr; + window.showAjaxError = jest.fn(); document.body.innerHTML = `
@@ -648,6 +663,7 @@ describe('tests for "users" module', () => { window.url = url; window.toastr = toastr; window.trans = trans; + window.showAjaxError = jest.fn(); document.body.innerHTML = `
@@ -720,6 +736,7 @@ describe('tests for "users" module', () => { window.url = url; window.toastr = toastr; window.trans = trans; + window.showAjaxError = jest.fn(); document.body.innerHTML = `
@@ -784,6 +801,7 @@ describe('tests for "users" module', () => { window.toastr = toastr; window.trans = trans; window.swal = swal; + window.showAjaxError = jest.fn(); document.body.innerHTML = ''; const deleteUserAccount = require(modulePath).deleteUserAccount; diff --git a/resources/assets/src/js/__tests__/user.test.js b/resources/assets/src/js/__tests__/user.test.js index 27f1a4b2..9da5fb06 100644 --- a/resources/assets/src/js/__tests__/user.test.js +++ b/resources/assets/src/js/__tests__/user.test.js @@ -22,6 +22,7 @@ describe('tests for "closet" module', () => { window.trans = trans; window.url = url; window.MSP = MSP; + window.showAjaxError = jest.fn(); document.body.innerHTML = `
@@ -71,6 +72,7 @@ describe('tests for "closet" module', () => { const url = jest.fn(path => path); window.trans = trans; window.url = url; + window.showAjaxError = jest.fn(); document.body.innerHTML = ` @@ -126,6 +128,7 @@ describe('tests for "closet" module', () => { window.url = url; window.swal = swal; window.toastr = toastr; + window.showAjaxError = jest.fn(); document.body.innerHTML = `
@@ -174,6 +177,7 @@ describe('tests for "closet" module', () => { window.url = url; window.swal = swal; window.toastr = toastr; + window.showAjaxError = jest.fn(); document.body.innerHTML = `
@@ -226,6 +230,7 @@ describe('tests for "closet" module', () => { window.url = url; window.swal = swal; window.toastr = toastr; + window.showAjaxError = jest.fn(); document.body.innerHTML = `
@@ -275,6 +280,7 @@ describe('tests for "closet" module', () => { window.url = url; window.swal = swal; window.toastr = toastr; + window.showAjaxError = jest.fn(); document.body.innerHTML = ` User Image @@ -316,6 +322,7 @@ describe('tests for "player" module', () => { })); window.url = url; window.fetch = fetch; + window.showAjaxError = jest.fn(); window.TexturePreview = require('../common/texture-preview'); window.MSP = { changeSkin: jest.fn(), @@ -353,6 +360,7 @@ describe('tests for "player" module', () => { window.fetch = fetch; window.url = url; window.toastr = toastr; + window.showAjaxError = jest.fn(); document.body.innerHTML = ` @@ -445,6 +454,7 @@ describe('tests for "player" module', () => { window.url = url; window.trans = trans; window.toastr = toastr; + window.showAjaxError = jest.fn(); $.fn.modal = modal; document.body.innerHTML = ` @@ -489,6 +499,7 @@ describe('tests for "player" module', () => { window.url = url; window.toastr = toastr; window.swal = swal; + window.showAjaxError = jest.fn(); document.body.innerHTML = `
@@ -531,6 +542,7 @@ describe('tests for "player" module', () => { window.url = url; window.toastr = toastr; window.swal = swal; + window.showAjaxError = jest.fn(); $.fn.modal = modal; document.body.innerHTML = ` @@ -570,6 +582,7 @@ describe('tests for "player" module', () => { window.swal = swal; $.fn.modal = modal; window.selectedTextures = {}; + window.showAjaxError = jest.fn(); document.body.innerHTML = ` @@ -614,6 +627,7 @@ describe('tests for "profile" module', () => { window.trans = trans; window.url = url; window.debounce = jest.fn(fn => fn); + window.showAjaxError = jest.fn(); document.body.innerHTML = `
@@ -661,6 +675,7 @@ describe('tests for "profile" module', () => { window.trans = trans; window.url = url; window.toastr = toastr; + window.showAjaxError = jest.fn(); window.logout = jest.fn().mockReturnValue(Promise.resolve({ errno: 0 })); document.body.innerHTML = ` @@ -722,6 +737,7 @@ describe('tests for "profile" module', () => { window.trans = trans; window.url = url; window.toastr = toastr; + window.showAjaxError = jest.fn(); window.logout = jest.fn().mockReturnValue(Promise.resolve({ errno: 0 })); document.body.innerHTML = ` @@ -769,6 +785,7 @@ describe('tests for "profile" module', () => { window.trans = trans; window.url = url; window.toastr = toastr; + window.showAjaxError = jest.fn(); document.body.innerHTML = `