fix the nodejs api + add unit tests for node

I knew i should have added those tests