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

80% Statements 8/10
87.5% Branches 7/8
75% Functions 3/4
80% Lines 8/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                                    147×   84×   28×   14× 14× 28×           21×        
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 '';
    }
  }
}