jest catch error in test code example
Example 1: jest test try catch
expect(() => {
const model = new Sample(resolvedSample)
}).toThrow(TypeError);
Example 2: jest expect error to be thrown
test("Test description", () => {
const t = () => {
throw new TypeError();
};
expect(t).toThrow(TypeError);
});