Write working index.js and fix basic test