title: Mocking jsonwebtoken module with Jest
body: <p>I try to mock with jest the verify function of the npm module jsonwebtoken. The function return a decoded token but i want to pass a custom return of this function my unit test.</p>
  <p>I made express request that check the validity of access tokent before proceed to request. But I want to mock the moment of the token check to return directly the user value. And pass easily this step. I put you the concern part of code.</p>
  <p>But typescript send me this error:
  Property 'mockReturnValue' does not exist on type '{ (token: string, secretOrPublicKey: Secret, options?: VerifyOptions | undefined): string | object; (token: string, secretOrPublicKey: string | Buffer | { key: string | Buffer; passphrase: string; } | GetPublicKeyOrSecret, callback?: VerifyCallback | undefined): void; (token: string, secretOrPublicKey: string | ... ...'.</p>
  <p>So the mock isn't working and I don't understant. I follow the mock axios step on Jest.io but it's didn't seem apply to jsonwebtoken.</p>
  <p>Is everyone know what is the problem or how to mock this jsonwebtoken module on jest ?</p>
  <blockquote>
  <p>users.test.ts</p>
  </blockquote>
  <pre><code>import jwt from 'jsonwebtoken'
      jest.mock('jwt')
      jwt.verify.mockReturnValue({
                      userId: String(member._id),
                      email: String(member.email),
                      permissionLevel: member.permissionLevel,
                      username: String(member.username),
                  })
  
  describe('### /GET users', () =&gt; {
              it('it should return 200 (Users List)', async (done) =&gt; {
                  const res = await request(app).set('Authorization', 'Bearer').get('/users')
                  expect(res.status).toBe(200)
              })
  })
  </code></pre>
  <blockquote>
  <p>Validation.ts</p>
  </blockquote>
  <pre><code>public isAccessTokenValid = (req: Request, res: Response, next: NextFunction): void =&gt; {
          if (req.cryptedAccessToken) {
              try {
                  req.accessToken = jwt.verify(req.cryptedAccessToken, ACCESS_TOKEN_SECRET)
                  next()
              } catch (err) {
                  res.status(498).send({ error: err.message })
              }
          } else res.status(401).send({ error: 'cryptedAccessToken field not present in request' })
      }
  </code></pre>
  <p>Best regards</p>