Skip to content

Instantly share code, notes, and snippets.

@goldbergyoni
Created December 30, 2018 19:51
Show Gist options
  • Select an option

  • Save goldbergyoni/a82b32dfdaf97578411c5c236fa3183f to your computer and use it in GitHub Desktop.

Select an option

Save goldbergyoni/a82b32dfdaf97578411c5c236fa3183f to your computer and use it in GitHub Desktop.
Skim through complex code to understand the test
it("When asking for an admin, ensure only ordered admins in results" , ()={
//assuming we've added here two admins "admin1", "admin2" and "user1"
const allAdmins = getUsers({adminOnly:true});
const admin1Found, adming2Found = false;
allAdmins.forEach(aSingleUser => {
if(aSingleUser === "user1"){
assert.notEqual(aSingleUser, "user1", "A user was found and not admin");
}
if(aSingleUser==="admin1"){
admin1Found = true;
}
if(aSingleUser==="admin2"){
admin2Found = true;
}
});
if(!admin1Found || !admin2Found ){
throw new Error("Not all admins were returned");
}
});
@AlexJukes
Copy link

Line 5, there's a typo in the second variable :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment