From c9cd741aff6acedaedfd2cf96df06a8b46b4826a Mon Sep 17 00:00:00 2001 From: Rohit Sharma Date: Thu, 14 Jan 2021 01:43:30 +0530 Subject: 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 --- js/tests/unit/tooltip.spec.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'js/tests/unit/tooltip.spec.js') diff --git a/js/tests/unit/tooltip.spec.js b/js/tests/unit/tooltip.spec.js index 8224c3437..213dcc91f 100644 --- a/js/tests/unit/tooltip.spec.js +++ b/js/tests/unit/tooltip.spec.js @@ -1207,11 +1207,9 @@ describe('Tooltip', () => { jQueryMock.fn.tooltip = Tooltip.jQueryInterface jQueryMock.elements = [div] - try { + expect(() => { jQueryMock.fn.tooltip.call(jQueryMock, action) - } catch (error) { - expect(error.message).toEqual(`No method named "${action}"`) - } + }).toThrowError(TypeError, `No method named "${action}"`) }) }) }) -- cgit v1.2.3