move test logic to js