aqa-test-tools
aqa-test-tools copied to clipboard
Simplify the logic in PerfCompare.js
In PerfCompare.js, we are using undefined, null, "" to represent different meanings. I think we should simplify the logic.
-
[ ]
higherbettershould have only two state. i.e., true or false. There is no need to have a third stateundefined. The default value forhigherbetterin BenchmarkMetric.js should be true. It only needs to set explicitly if it is false. -
[ ] Remove sepcific checks for
undefined,null,"". Update code as the following:
if (resBenchmarkRunsJson === undefined || (Object.keys(resBenchmarkRunsJson).length === 0 && resBenchmarkRunsJson.constructor === Object) ||
resBenchmarkRunsJson.baselineCSV === undefined || resBenchmarkRunsJson.testCSV === undefined) {
to
if (!resBenchmarkRunsJson || !resBenchmarkRunsJson.baselineCSV || !resBenchmarkRunsJson.testCSV)
Please check the code and update similar checks.