Open TooManyLogs opened 3 years ago
@TooManyLogs I believe the issue here is that your class is not initialised and hence not picked up as a handler.
Change the export statement to:
class MyIntent {
async handle () {
await this.invoke('myParam');
}
invoke (paramName = {}) {
const params = {
paramName
};
return Client.invoke(params)
.promise()
.then(response =>
JSON.parse(response.Payload)
);
};
}
}
module.exports = new MyIntent();
Hi, having some trouble getting mock to work inside a class.
In the following code the mock is not being called at all when testing class
This is an example of the class based approach i'm trying to test
The same code without class will run the mock when testing