all files / js/helper/ TestHelper.class.js

90% Statements 9/10
87.5% Branches 7/8
100% Functions 4/4
90% Lines 9/10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38                  153×                 342×   261×   36×   18× 18× 36×           27×        
import TestData from './TestData';
 
/* eslint-disable require-jsdoc */
export default class testHelper {
  static data() {
    return TestData;
  }
 
  static debug(config, method, value) {
    // eslint-disable-next-line no-console
    return console.log(
      config.name,
      method.name,
      this.escape(value),
      method.expect
    );
  }
 
  static escape(value) {
    switch (true) {
      case typeof value === 'string':
        return (value.length > 0) ? `'${value}'` : value;
      case typeof value === 'number':
        return value;
      case typeof value === 'object':
        Eif (Array.isArray(value)) {
          return value.map((item) => {
            this.escape(item);
          }).join(',');
        } else {
          return value;
        }
      default:
        return '';
    }
  }
}