Skip to content

Commit 99fec8c

Browse files
committed
零代码回归测试:解决 Response hint 断言 路径显示 错误
1 parent bb554c6 commit 99fec8c

File tree

3 files changed

+109
-104
lines changed

3 files changed

+109
-104
lines changed

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api/apijson/JSONResponse.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,8 @@ var JSONResponse = {
921921
};
922922

923923
var realType = JSONResponse.getType(real);
924-
if (type != realType && (type != 'number' || realType != 'integer')) { //类型改变
925-
log('compareWithStandard type != getType(real) >> return COMPARE_TYPE_CHANGE');
924+
if (type != realType && type != 'undefined' && (type != 'number' || realType != 'integer')) { //类型改变
925+
log('compareWithStandard type != realType && type != undefined && (type != number || realType != integer) >> return COMPARE_TYPE_CHANGE');
926926

927927
max = {
928928
code: JSONResponse.COMPARE_TYPE_CHANGE,
@@ -982,7 +982,7 @@ var JSONResponse = {
982982
}
983983
log('compareWithStandard for tk = ' + tk + ' >> ');
984984

985-
each = JSONResponse.compareWithStandard(firstVal[tk], real[tk], JSONResponse.getAbstractPath(folder, tk), exceptKeys);
985+
each = JSONResponse.compareWithStandard(firstVal[tk], real[tk], JSONResponse.getAbstractPath(folder, tk), exceptKeys);
986986
if (max.code < each.code) {
987987
max = each;
988988
}

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api/apijson/StringUtil.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ var StringUtil = {
2424
* @return
2525
*/
2626
get: function(s) {
27-
return s == null ? '' : s;
27+
return s == null ? '' : (JSONResponse.isString(s) ? s : JSON.stringify(s));
2828
},
2929

3030
/**获取去掉前后空格后的string,为null则返回''
3131
* @param s
3232
* @return
3333
*/
3434
trim: function(s) {
35-
return s == null ? '' : s.trim();
35+
return StringUtil.get(s).trim();
3636
},
3737

3838
/**获取去掉所有空格后的string,为null则返回''

0 commit comments

Comments
 (0)