Jeremy Moritz
Jeremy Moritz

Reputation: 14922

If path not taken on parameter

I am getting the message in Karma that the "if path not taken" for each of these 4 private methods.

I have several unit tests that call each of these private methods with various values, and many of these set the isReq property to true or false, so I'm not sure why it thinks that there's any path I'm not testing. Any ideas?

if path not taken?

And here's a pic of some of my relevant test code:

enter image description here

Upvotes: 0

Views: 6755

Answers (2)

Jeremy Moritz
Jeremy Moritz

Reputation: 14922

SOLUTION FOUND!

I discovered what my problem was: I am calling the public method which provides a default value on the boolean. Then the public method is calling one private method which is calling another which is calling another. The initial public method sets a default value which is passed to the first private method. So from that point forward, there is always a value being passed in! It's never using the default values supplied because there's always a value passed into the private methods.

So the solution was merely to remove the default supplied values for the private methods as these are never being used.

I just wanted to post this here in case it helps someone else who has struggled with this same concept as i have.

Upvotes: 4

Andrew Eisenberg
Andrew Eisenberg

Reputation: 28757

It's likely that getUploadedFormGroup is returning falsy and so getUploadedArray is never being called.

Upvotes: 0

Related Questions