diff options
| author | Ben Lertlumprasertkul <[email protected]> | 2021-05-11 06:45:57 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-05-11 08:45:57 +0300 |
| commit | 052def456845c2147e4e6c99d17bba12fcbee34c (patch) | |
| tree | 9f23d9f09941c43fd519bde2498da808a8764635 /js/tests/unit/button.spec.js | |
| parent | 9c3ab6557ec89ae11cc27da1b4680b3e69381edf (diff) | |
| download | bootstrap-052def456845c2147e4e6c99d17bba12fcbee34c.tar.xz bootstrap-052def456845c2147e4e6c99d17bba12fcbee34c.zip | |
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 <[email protected]>
Diffstat (limited to 'js/tests/unit/button.spec.js')
| -rw-r--r-- | js/tests/unit/button.spec.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/js/tests/unit/button.spec.js b/js/tests/unit/button.spec.js index e7d92cb6d..90cf76614 100644 --- a/js/tests/unit/button.spec.js +++ b/js/tests/unit/button.spec.js @@ -91,7 +91,7 @@ describe('Button', () => { const btnEl = fixtureEl.querySelector('.btn') const button = new Button(btnEl) - expect(Button.getInstance(btnEl)).toBeDefined() + expect(Button.getInstance(btnEl)).not.toBeNull() button.dispose() @@ -126,7 +126,7 @@ describe('Button', () => { jQueryMock.fn.button.call(jQueryMock, 'toggle') - expect(Button.getInstance(btnEl)).toBeDefined() + expect(Button.getInstance(btnEl)).not.toBeNull() expect(btnEl.classList.contains('active')).toEqual(true) }) @@ -140,7 +140,7 @@ describe('Button', () => { jQueryMock.fn.button.call(jQueryMock) - expect(Button.getInstance(btnEl)).toBeDefined() + expect(Button.getInstance(btnEl)).not.toBeNull() expect(btnEl.classList.contains('active')).toEqual(false) }) }) |
