aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/carousel.spec.js
diff options
context:
space:
mode:
authorRohit Sharma <[email protected]>2021-01-14 01:43:30 +0530
committerGitHub <[email protected]>2021-01-13 22:13:30 +0200
commitc9cd741aff6acedaedfd2cf96df06a8b46b4826a (patch)
tree01d31a107078fe4f30879e162df8e45336d5f4ef /js/tests/unit/carousel.spec.js
parente34481b6eb5c7b9db35911f428cb96af6947741e (diff)
downloadbootstrap-c9cd741aff6acedaedfd2cf96df06a8b46b4826a.tar.xz
bootstrap-c9cd741aff6acedaedfd2cf96df06a8b46b4826a.zip
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 <[email protected]>
Diffstat (limited to 'js/tests/unit/carousel.spec.js')
-rw-r--r--js/tests/unit/carousel.spec.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/js/tests/unit/carousel.spec.js b/js/tests/unit/carousel.spec.js
index 0286762fa..787a276de 100644
--- a/js/tests/unit/carousel.spec.js
+++ b/js/tests/unit/carousel.spec.js
@@ -1136,11 +1136,9 @@ describe('Carousel', () => {
jQueryMock.fn.carousel = Carousel.jQueryInterface
jQueryMock.elements = [div]
- try {
+ expect(() => {
jQueryMock.fn.carousel.call(jQueryMock, action)
- } catch (error) {
- expect(error.message).toEqual(`No method named "${action}"`)
- }
+ }).toThrowError(TypeError, `No method named "${action}"`)
})
})