Monday, 26 March 2018

mocha test case color code explanation

https://stackoverflow.com/questions/26618243/how-do-i-read-an-istanbul-coverage-report

There are a number of coverage criteria, the main ones being:
  • Function coverage Has each function (or subroutine) in the program been called?
  • Statement coverage Has each statement in the program been executed?
  • Branch coverage Has each branch (also called DD-path) of each control structure (such as in if and case statements) been executed? For example, given an if statement, have both the true and false branches been executed? Another way of saying this is, has every edge in the program been executed?
  • Line coverage has each executable line in the source file been executed?
For each case, the percentage represents executed code vs not-executed code, which equals each fraction in percent format (e.g: 50% branches, 1/2).
In the file report:
  • 'E' stands for 'else path not taken', which means that for the marked if/else statement, the 'if' path has been tested but not the 'else'.
  • 'I' stands for 'if path not taken', which is the opposite case: the 'if' hasn't been tested.
  • The xN in left column is the amount of times that line has been executed.
  • Not executed lines, or pieces of code, will be highlighted in red.
This has been verified for Istanbul v0.4.0, I'm not sure if this still applies for subsequent versions, but being that library is based on solid theoretic principles, behavior shouldn't change too much for newer versions.
It also provides some color codes -
Pink: statements not covered.
Orange: functions not covered.
Yellow: branches not covered.
Full Istanbul docs here:
For more in-depth theory on code coverage:
Hope it helps!

Thursday, 22 March 2018

rejex link

https://www.youtube.com/watch?v=qtKEbrWpTx4

https://www.youtube.com/watch?v=9zixgQaKRHw

Tuesday, 20 March 2018

create email template in aws ses

https://aws.amazon.com/blogs/ses/introducing-email-templates-and-bulk-sending/


go to your file location  and then fire this command
aws ses create-template --cli-input-json file://mytemplate.json

joi validation for Boolean value

https://stackoverflow.com/questions/33019936/using-joi-validating-that-a-boolean-is-true


Joi.validate(false, schema);
Joi.validate('false', schema);
Joi.validate('no', schema);
Joi.validate('off', schema);
Joi.validate(0, schema);