jest test try catch

CSS
expect(() => {
   const model = new Sample(resolvedSample)
}).toThrow(TypeError);describe('Dummy test', () => {
  class Sample {
      constructor(data){
        this.resolvedData = this.retrieveData(data) 
      }

      retrieveData(data){
        try{
          const resolvedData = data.map(o => o.name);
        }catch(error){
          throw error
        }
      }   
  }

  test('should fail', () => {
      expect(() => {
          new Sample({});
      }).toThrowError(TypeError);
  });
});
Source

Also in CSS: