samedi 16 novembre 2019

JavaScript in Postman - else if - unexpected token "else"

I'm working on an API within postman and writing a test script to decide what to do next.

I'm able to run this code just fine:

if (    environment.JobStatus == "DONE")
{
    postman.setNextRequest("Export Results")
}
else 
{
    sleep(5000).then(() => {
    postman.setNextRequest("Get Job Status")
})}

But when trying to run this code:

if (    environment.JobStatus == "DONE") 
{
  postman.setNextRequest("Export Results");
} 
else if (    environment.JobStatus == "INPROGRESS"); 
{
  sleep(5000).then(() => {
  postman.setNextRequest("Get Job Status");
})}
else {
  postman.setNextRequest("null");
}

I get the following error:

There was an error in evaluating the test script: SyntaxError: Unexpected token else

And at the line my text editor states the following:

Expected an identifier and instead saw 'else'. Missing ";" before statement

Aucun commentaire:

Enregistrer un commentaire