All files / lib/Io index.js

83.33% Statements 10/12
100% Branches 0/0
80% Functions 4/5
83.33% Lines 10/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 39 40 41 42 43        3x 3x                             6x 6x 6x 6x 6x 6x                 8x               3x
/**
 * This Io will handle the input and output format/method of the modules
 */
 
const read = require('./read');
const write = require('./write');
 
class Io {
  // read = require('./read')
  // write = require('./write')
 
  // To keep original input and output
  // In case we use them
  // input = null
  // output = null
 
  // The jQuery DOM representation of the input
  // $ = null
 
  constructor(input, output) {
    this.input = input;
    this.output = output;
    this.get$ = new Promise((resolve, reject) => {
      try {
        read(this.input, ($) => {
          resolve($);
        });
      } catch (err) {
        reject(err);
      }
    });
  }
 
  write(issues) {
    write(this.output, issues);
  }
 
  defineRule(config) {
    console.log('define defects rules with config', config);
  }
}
 
module.exports = Io;