https://pulumi.com logo
Title
l

little-cartoon-10569

11/25/2020, 10:25 PM
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?
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:
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...