refactor: write tests in JavaScript