Answers for "jest expect error type"

0

jest expect error type

test("Test description", () => {
  expect.assertions(2);
  try {
      throw new TypeError("UNKNOWN ERROR");
  } catch (e) {
  	expect(e).toThrow(TypeError);
    expect(e.message).toBe("UNKNOWN ERROR");
  }  
});
Posted by: Guest on July-17-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language