Added JS unit test. Func call fixes