Skip to content

Instantly share code, notes, and snippets.

@shridharkalagi
Created February 28, 2021 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shridharkalagi/4726ef860f000d5af18948d275c80685 to your computer and use it in GitHub Desktop.
Save shridharkalagi/4726ef860f000d5af18948d275c80685 to your computer and use it in GitHub Desktop.
import fetch from 'node-fetch'
usersList = ['user1', 'user2', ...'usern']
let userRequests = []
let userIndex = 0
for (let i = 0; i < 2; i++) {
for (let j = 0; j < 20; j++) {
userRequests.push(getEachUser(usersList[userIndex]))
userIndex++
}
await Promise.all(userRequests).then((responseData) => {
responseData.forEach((element) => {
const statusCode = element[0]
const user = element[1]
assert.equal(statusCode, 200, 'API call failed for user ' + user)
})
})
userRequests.splice(0, userRequests.length)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment