Nock in JavaScript