Minor bug fixes for tests

This commit is contained in:
printempw 2017-07-28 18:18:56 +08:00
parent 28c4d555d4
commit 153f515f15
23 changed files with 238 additions and 225 deletions

View File

@ -1,7 +0,0 @@
machine:
node:
version: 8.2.0
dependencies:
override:
- yarn

View File

@ -11,6 +11,7 @@
"private": true,
"scripts": {
"build": "gulp build",
"lint": "gulp lint",
"release": "gulp release",
"test": "jest --silent",
"test:watch": "jest --silent --watch",
@ -31,6 +32,7 @@
"gulp-uglify": "^3.0.0",
"gulp-zip": "^4.0.0",
"jest": "^20.0.4",
"node-sass": "^4.5.3",
"run-sequence": "^2.0.0"
},
"dependencies": {

View File

@ -1,3 +1,5 @@
/* eslint no-unused-vars: "off" */
const $ = require('jquery');
window.$ = window.jQuery = $;
@ -319,7 +321,7 @@ describe('tests for "plugins" module', () => {
await enablePlugin('plugin');
expect(fetch).toBeCalledWith({
type: 'POST',
url: 'admin/plugins?action=enable&name=plugin',
url: 'admin/plugins/manage?action=enable&name=plugin',
dataType: 'json'
});
expect(toastr.warning).not.toBeCalled();
@ -354,7 +356,7 @@ describe('tests for "plugins" module', () => {
await disablePlugin('plugin');
expect(fetch).toBeCalledWith({
type: 'POST',
url: 'admin/plugins?action=disable&name=plugin',
url: 'admin/plugins/manage?action=disable&name=plugin',
dataType: 'json'
});
expect(toastr.warning).not.toBeCalled();
@ -395,7 +397,7 @@ describe('tests for "plugins" module', () => {
});
expect(fetch).toBeCalledWith({
type: 'POST',
url: 'admin/plugins?action=delete&name=plugin',
url: 'admin/plugins/manage?action=delete&name=plugin',
dataType: 'json'
});
await deletePlugin('plugin');

View File

@ -1,3 +1,5 @@
/* eslint no-unused-vars: "off" */
const $ = require('jquery');
window.$ = window.jQuery = $;

View File

@ -1,3 +1,5 @@
/* eslint no-unused-vars: "off" */
const $ = require('jquery');
window.jQuery = window.$ = $;
@ -18,7 +20,7 @@ describe('tests for "i18n" module', () => {
it('get translated text', () => {
const trans = require(modulePath).trans;
expect(trans('text')).toBe('text');
expect(trans('text.nothing')).toBe('text.nothing');
expect(trans('nested.sth')).toBe(':sth here!');

View File

@ -1,3 +1,5 @@
/* eslint no-unused-vars: "off" */
const $ = require('jquery');
window.$ = window.jQuery = $;

View File

@ -1,3 +1,5 @@
/* eslint no-unused-vars: "off" */
const $ = require('jquery');
window.$ = window.jQuery = $;

View File

@ -1,5 +1,3 @@
/* exported changePreference, changeTexture, ajaxChangeTexture, changePlayerName, changeOwner, deletePlayer */
'use strict';
function changePreference() {

View File

@ -1,5 +1,3 @@
/* exported enablePlugin, disablePlugin, deletePlugin */
'use strict';
function enablePlugin(name) {

View File

@ -1,5 +1,3 @@
/* exported initUsersTable, initPlayersTable, initPluginsTable */
'use strict';
function initUsersTable() {
@ -270,3 +268,11 @@ function initPluginsTable() {
]
});
}
if (typeof require !== 'undefined' && typeof module !== 'undefined') {
module.exports = {
initUsersTable,
initPlayersTable,
initPluginsTable
};
}

View File

@ -1,5 +1,3 @@
/* exported downloadUpdates */
'use strict';
function downloadUpdates() {

View File

@ -1,6 +1,3 @@
/* exported changeUserEmail, changeUserNickName, changeUserPwd,
changeBanStatus, changeAdminStatus, deleteUserAccount */
'use strict';
function changeUserEmail(uid) {

View File

@ -1,5 +1,3 @@
/* exported trans */
'use strict';
$.locales = {};

View File

@ -1,5 +1,3 @@
/* exported showMsg, showAjaxError, showModal */
'use strict';
/**

View File

@ -1,5 +1,4 @@
/* global MSP */
/* exported TexturePreview */
class TexturePreview {
constructor(type, tid, preference) {

View File

@ -1,5 +1,3 @@
/* exported isEmpty, fetch, getQueryString, debounce, url */
'use strict';
console.log(`\n %c Blessing Skin v${blessing.version} %c https://blessing.studio \n\n`, 'color: #fadfa3; background: #030307; padding:5px 0;', 'background: #fadfa3; padding:5px 0;');
@ -102,6 +100,7 @@ if (typeof require !== 'undefined' && typeof module !== 'undefined') {
isEmpty,
fetch,
debounce,
getQueryString,
url
};
}

View File

@ -1,5 +1,3 @@
/* exported changeTextureName, deleteTexture */
'use strict';
$(document).on('click', '.more.like', function () {

View File

@ -1,5 +1,4 @@
/* global MSP */
/* exported upload */
'use strict';
@ -128,3 +127,9 @@ function upload() {
});
});
}
if (typeof require !== 'undefined' && typeof module !== 'undefined') {
module.exports = {
upload
};
}

View File

@ -1,5 +1,4 @@
/* global MSP */
/* exported renameClosetItem, removeFromCloset, setAsAvatar */
'use strict';

View File

@ -1,5 +1,4 @@
/* global MSP, defaultSkin, selectedTextures */
/* exported changePlayerName, clearTexture, ajaxClearTexture, addNewPlayer, deletePlayer, setTexture */
'use strict';
@ -213,6 +212,7 @@ if (typeof require !== 'undefined' && typeof module !== 'undefined') {
module.exports = {
changePlayerName,
ajaxClearTexture,
clearTexture,
deletePlayer,
addNewPlayer,
setTexture

View File

@ -1,5 +1,3 @@
/* exported changeNickName, changePassword, changeEmail, deleteAccount, deleteAccount */
'use strict';
function changeNickName() {

View File

@ -1,5 +1,3 @@
/* exported sign */
function sign() {
fetch({
type: 'POST',

393
yarn.lock

File diff suppressed because it is too large Load Diff