toThrow(error?)
Last updated
Was this helpful?
Last updated
Was this helpful?
별칭으로 .toThrowError(error?)
Note: You must wrap the code in a function, otherwise the error will not be caught and the assertion will fail.
꼭꼭 감싸줘야한다.
감싸지 않고, expect(number.toPrecision(101)).toThrow(RangeError);
이렇게 썼더니 test가 되지 않음
정규식: error message가 패턴과 일치
문자열: error message에 하위 문자열이 포함됨
error object: error message는 동일한 object의 message property
error class: error object는 class의 인스턴스
parameter가 생각보다 다양하네