Write test for most js function