I'm having trouble with using Chai Promise test in a Docker environment.
Here is a simple function:
let funcPromise = (n) => {
return new Promise((resolve, reject) =>{
if(n=="a") {
resolve("success");
} else {
reject("Fail");
}
});
}
A simple test:
import chai from 'chai';
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
let expect = chai.expect;
let assert = chai.assert;
it('connect: test promise', (done) => {
let func = funcPromise("a");
expect(func).to.eventually.equal("success"); // not working
expect(func).to.be.rejected; // not working
})
Error displayed on the terminal:
FileTest.spec.ts:43:25 - error TS2339: Property 'eventually' does not exist on type 'Assertion'.
storage/database/MongooseEngine.spec.ts:44:35 - error TS2339: Property 'rejected' does not exist on type 'Assertion'.