I have an issue with testing my simple function using chai assertion in my typescript code
I have:
public async test1(){
throw (new Error(COUCH_CONNECTION_ERROR.message));
}
In which couch connection error is defined this way:
export const COUCH_CONNECTION_ERROR: IErrorModel = {
code: "couch_connection_error",
message: "Unable to connect to Couchdb.",
};
Now I wrote a test this way:
it("test", ()=>{
console.log(obj.test1());
expect(obj.test1()).to.throw(Error, COUCH_CONNECTION_ERROR.message)
console.log(`ccccccccccccccccc`);
})
So when when I run the test I get
AssertionError: expected {} to be a function
Can anyone help to understand what is wrong with my test?