diff options
author | Rohit Sharma <rohit2sharma95@gmail.com> | 2021-01-13 23:13:30 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-13 23:13:30 +0300 |
commit | c9cd741aff6acedaedfd2cf96df06a8b46b4826a (patch) | |
tree | 01d31a107078fe4f30879e162df8e45336d5f4ef /js/tests/unit/scrollspy.spec.js | |
parent | e34481b6eb5c7b9db35911f428cb96af6947741e (diff) |
Throw a `TypeError` instead of the generic `Error` (#32585)
* Change from Error to TypeError
* Convert the `NAME` to upper case to make the consistency in the error message
* Update the remaining tests to be stricter
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Diffstat (limited to 'js/tests/unit/scrollspy.spec.js')
-rw-r--r-- | js/tests/unit/scrollspy.spec.js | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/js/tests/unit/scrollspy.spec.js b/js/tests/unit/scrollspy.spec.js index eab9183aa6..0d175aafa3 100644 --- a/js/tests/unit/scrollspy.spec.js +++ b/js/tests/unit/scrollspy.spec.js @@ -625,11 +625,9 @@ describe('ScrollSpy', () => { jQueryMock.fn.scrollspy = ScrollSpy.jQueryInterface jQueryMock.elements = [div] - try { + expect(() => { jQueryMock.fn.scrollspy.call(jQueryMock, action) - } catch (error) { - expect(error.message).toEqual(`No method named "${action}"`) - } + }).toThrowError(TypeError, `No method named "${action}"`) }) }) |