[JS] Update code for tests to pass