From 052def456845c2147e4e6c99d17bba12fcbee34c Mon Sep 17 00:00:00 2001 From: Ben Lertlumprasertkul Date: Tue, 11 May 2021 06:45:57 +0100 Subject: Remove potential false positive assertions (#33288) * Remove potential false positive assertions querySelector() returns null but expect(document.querySelector('...')).toBeDefined() tests that the value is not undefined * Migrated assertions from .toBeDefined() to .not.toBeNull() for .getInstance() calls in tests * Migrate offcanvas assertions from .toBeDefined() to .not.toBeNull() for .getInstance() call * convert more cases to not.toBeNull assertions Co-authored-by: XhmikosR --- js/tests/unit/carousel.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/tests/unit/carousel.spec.js') diff --git a/js/tests/unit/carousel.spec.js b/js/tests/unit/carousel.spec.js index 75c3bbd6d..324ff19a7 100644 --- a/js/tests/unit/carousel.spec.js +++ b/js/tests/unit/carousel.spec.js @@ -1213,7 +1213,7 @@ describe('Carousel', () => { jQueryMock.fn.carousel.call(jQueryMock) - expect(Carousel.getInstance(div)).toBeDefined() + expect(Carousel.getInstance(div)).not.toBeNull() }) it('should not re create a carousel', () => { @@ -1271,7 +1271,7 @@ describe('Carousel', () => { window.dispatchEvent(loadEvent) - expect(Carousel.getInstance(carouselEl)).toBeDefined() + expect(Carousel.getInstance(carouselEl)).not.toBeNull() }) it('should create carousel and go to the next slide on click (with real button controls)', done => { -- cgit v1.2.3