Thursday, 11 May 2017

unit test for a line of code

I'm new at writing unit tests and I'm writing unit tests for my bot code. I have this part bothering me :

const accessToken = (() => {
  if (process.argv.length !== 3) {
    console.log('usage: node main/implementation');
    process.exit(1);
  }
  return process.argv[2];
})();

istanbul is showing me that this line return process.argv[2]; is not covered, but I don't have any idea about writing a unit test for that line. Any idea ?



via ezdin gharbi

No comments:

Post a Comment