teste assíncrono chai
const chai = require('chai');
const expect = chai.expect;
chai.use(require('chai-as-promised'));
async function methodToFail() {
throw new Error("Failed");
}
await expect(methodToFail()).to.be.rejectedWith("Failed");
Jos