Add unit-test and js api