Looking for some help with js (Jasmine) unit testing...

purbeast0

No Lifer
Sep 13, 2001
53,658
6,532
126
I created a fiddle with an example of what I am trying to test. Here is the fiddle:

Well this forum is so stupid and I can't link to j-s-fiddle, so please replase j-s-fiddle in the URL with the real thing.

https://j-s-fiddle.net/0f9kdjb8/

So basically, I am trying to write a unit test to test out the doStuff method, but when it hits each case, I just want to spy on the methods like a, b, or c, instead of checking out the return values, because each of those functions a, b, and c either return true or false. So instead of just testing against true or false, I want to be sure the correct cast is his.

I am having trouble figuring out a way to do this with the way it's currently coded. Is it possible with spies to do this? And if not, what is the recommended way to test in this manner?