title: How can I test a catch block using jest nodejs?
body: <p>How can i test the catch block on a es6 Class</p>
  
  <pre><code>const fs = require('fs');
  class Service {
    constructor(accessToken) {
      this.accessToken = accessToken;
    }
  
    async getData() { // eslint-disable-line class-methods-use-this
      try {
  
  
        const data = fs.readFileSync(`${__dirname}/models/mockData.json`, { encoding: 'utf8' });
        const returnData = JSON.parse(data);
        return returnData;
      } catch (err) {
        return err;
      }
    }
  }
  
  module.exports = Service;
  </code></pre>
  
  <p>using jest how can i write the test case to cover the catch block also.</p>