knee-cola / jest-mock-axios

Axios mock for Jest
252 stars 42 forks source link

Error when using with @slack/web-api #88

Closed CezarManea closed 2 years ago

CezarManea commented 2 years ago

Because of this line of code https://github.com/slackapi/node-slack-sdk/blob/main/packages/web-api/src/WebClient.ts#L216

When you use jest-mock-axios in combination with @slack/web-api you get failed tests with the following error:

    TypeError: Cannot convert undefined or null to object

       6 |
       7 |     constructor() {
    >  8 |         this.slackClient = new WebClient(Config.slack.token);
         |            

Solution is to add here https://github.com/knee-cola/jest-mock-axios/blob/master/lib/mock-axios.ts#L139

post: {}
kingjan1999 commented 2 years ago

Fixed with v4.6.2 / v4.7.0-beta2