Is it possible to compare output values in Mocha+C...
# typescript
l
Is it possible to compare output values in Mocha+ChaiAsPromised tests? I use assertions like
return expect(bucketObject.name.promise()).to.eventually.eql("Joanne.txt");
Is there a way to do something more like this?
Copy code
return user.name.promise().then(username => expect(bucketObject.name.promise()).to.eventually.eql(`${username}.txt`));
Currently I'm using this but it seems excessively clunky:
Copy code
return expect(Promise.all([
  bucketObject.name.promise(),
  user.name.promise()
])).to.eventually.satisfy((names: Promise<string>[]) => names[0] == `${names[1]}.txt`, "User and file names don't match");
Plus there's no easy way to display the actual and expected values.. the message is outside the promise-resolution code, but the assertion is inside it...