Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Statement not covered in Code Coverage in Jasmine

I have a unit-test run with Jasmine. When i run this unit-test it not have any error, but when i view it in code coverage. It show some error with message: "Statement not covered"

Error

I want to solve this error. What can i do? Thanks

like image 452
Pham Minh Tan Avatar asked Oct 23 '25 17:10

Pham Minh Tan


2 Answers

Ask yourself if this is an actual error. ;)

Your unit-test run and as you said, the unit test runs without error. Good for you! Code coverage however shows you that the indicated lines are not tested. This is not an 'error'. Your job is to write more test, to explicitly test these lines.

like image 167
Just-a-random-guy Avatar answered Oct 26 '25 08:10

Just-a-random-guy


if you want to solve this then you should have additional unit tests which tests the cases when paymentData.accessionInfo and paymentData.prepaymentInfo are set to truthy values.

It seems that currently your tests do not contain the correct data to enable those code paths to be executed

like image 22
Sam Holder Avatar answered Oct 26 '25 07:10

Sam Holder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!