diff --git a/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js b/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js index 2f3ea31dc2..4ad337e85a 100644 --- a/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js +++ b/packages/material-ui-lab/src/Autocomplete/Autocomplete.test.js @@ -1018,7 +1018,7 @@ describe('', () => { fireEvent.keyDown(textbox, { key: 'Enter' }); expect(handleChange.callCount).to.equal(1); expect(handleChange.args[0][1]).to.equal('a'); - expect(consoleErrorMock.callCount()).to.equal(4); // strict mode renders twice + expect(consoleErrorMock.callCount()).to.equal(3); expect(consoleErrorMock.messages()[0]).to.include( 'Material UI: The `getOptionLabel` method of Autocomplete returned undefined instead of a string', ); @@ -1070,7 +1070,7 @@ describe('', () => { />, ); - expect(consoleWarnMock.callCount()).to.equal(4); // strict mode renders twice + expect(consoleWarnMock.callCount()).to.equal(2); expect(consoleWarnMock.messages()[0]).to.include( 'None of the options match with `"not a good value"`', ); @@ -1099,7 +1099,7 @@ describe('', () => { const options = getAllByRole('option').map((el) => el.textContent); expect(options).to.have.length(7); expect(options).to.deep.equal(['A', 'D', 'E', 'B', 'G', 'F', 'C']); - expect(consoleWarnMock.callCount()).to.equal(2); // strict mode renders twice + expect(consoleWarnMock.callCount()).to.equal(1); expect(consoleWarnMock.messages()[0]).to.include('returns duplicated headers'); }); }); diff --git a/packages/material-ui-lab/src/TreeView/TreeView.test.js b/packages/material-ui-lab/src/TreeView/TreeView.test.js index 50c9f5d05c..59ff4d8fd0 100644 --- a/packages/material-ui-lab/src/TreeView/TreeView.test.js +++ b/packages/material-ui-lab/src/TreeView/TreeView.test.js @@ -118,8 +118,7 @@ describe('', () => { const { current: { errors }, } = errorRef; - expect(errors).to.have.length(1); - expect(errors[0].toString()).to.include('RangeError: Maximum call stack size exceeded'); + expect(errors).to.have.length(0); }); }); diff --git a/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js b/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js index 9013d90955..7f0862466d 100644 --- a/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js +++ b/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js @@ -135,7 +135,7 @@ describe('ThemeProvider', () => {
, ); - expect(consoleErrorMock.callCount()).to.equal(2); // strict mode renders twice + expect(consoleErrorMock.callCount()).to.equal(1); expect(consoleErrorMock.messages()[0]).to.include('However, no outer theme is present.'); }); @@ -148,7 +148,7 @@ describe('ThemeProvider', () => { , , ); - expect(consoleErrorMock.callCount()).to.equal(2); // strict mode renders twice + expect(consoleErrorMock.callCount()).to.equal(1); expect(consoleErrorMock.messages()[0]).to.include( 'Material UI: You should return an object from your theme function', ); diff --git a/packages/material-ui/src/Breadcrumbs/Breadcrumbs.test.js b/packages/material-ui/src/Breadcrumbs/Breadcrumbs.test.js index ed0e37f214..49d8ea9b0f 100644 --- a/packages/material-ui/src/Breadcrumbs/Breadcrumbs.test.js +++ b/packages/material-ui/src/Breadcrumbs/Breadcrumbs.test.js @@ -102,7 +102,7 @@ describe('', () => { ); expect(getAllByRole('listitem', { hidden: false })).to.have.length(4); expect(getByRole('list')).to.have.text('first/second/third/fourth'); - expect(consoleErrorMock.callCount()).to.equal(2); // strict mode renders twice + expect(consoleErrorMock.callCount()).to.equal(1); expect(consoleErrorMock.messages()[0]).to.include( 'Material UI: You have provided an invalid combination of props to the Breadcrumbs.\nitemsAfterCollapse={2} + itemsBeforeCollapse={2} >= maxItems={3}', ); diff --git a/packages/material-ui/src/ClickAwayListener/ClickAwayListener.test.js b/packages/material-ui/src/ClickAwayListener/ClickAwayListener.test.js index fdf7e6e3ae..5d58e3fdeb 100644 --- a/packages/material-ui/src/ClickAwayListener/ClickAwayListener.test.js +++ b/packages/material-ui/src/ClickAwayListener/ClickAwayListener.test.js @@ -160,8 +160,7 @@ describe('', () => { expect(handleClickAway.callCount).to.equal(0); fireEvent.click(getByText('Stop inside a portal')); - // True-negative, we don't have enough information to do otherwise. - expect(handleClickAway.callCount).to.equal(1); + expect(handleClickAway.callCount).to.equal(0); }); it('should not be called during the same event that mounted the ClickAwayListener', () => { diff --git a/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js b/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js index 09daadd961..1eaf806289 100644 --- a/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js +++ b/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js @@ -261,7 +261,7 @@ describe('', () => { }); forceUpdate(); - expect(consoleErrorMock.callCount()).to.equal(3); // strict mode renders twice + expect(consoleErrorMock.callCount()).to.equal(1); expect(consoleErrorMock.messages()[0]).to.include('Material UI: Too many re-renders.'); }); }); diff --git a/packages/material-ui/src/internal/SwitchBase.test.js b/packages/material-ui/src/internal/SwitchBase.test.js index 41a38bc073..c9397fd133 100644 --- a/packages/material-ui/src/internal/SwitchBase.test.js +++ b/packages/material-ui/src/internal/SwitchBase.test.js @@ -373,7 +373,7 @@ describe('', () => { wrapper.setProps({ checked: true }); expect(consoleErrorMock.callCount()).to.equal(2); expect(consoleErrorMock.messages()[0]).to.include( - 'Warning: A component is changing an uncontrolled input of type checkbox to be controlled.', + 'Warning: A component is changing an uncontrolled input to be controlled.', ); expect(consoleErrorMock.messages()[1]).to.include( 'Material UI: A component is changing the uncontrolled checked state of SwitchBase to be controlled.', @@ -392,7 +392,7 @@ describe('', () => { setProps({ checked: undefined }); expect(consoleErrorMock.callCount()).to.equal(2); expect(consoleErrorMock.messages()[0]).to.include( - 'Warning: A component is changing a controlled input of type checkbox to be uncontrolled.', + 'Warning: A component is changing a controlled input to be uncontrolled.', ); expect(consoleErrorMock.messages()[1]).to.include( 'Material UI: A component is changing the controlled checked state of SwitchBase to be uncontrolled.', diff --git a/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js b/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js index ba9977d1a2..b5ca0ca4b9 100644 --- a/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js +++ b/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js @@ -285,7 +285,7 @@ describe('useMediaQuery', () => { render(); // logs warning twice in StrictMode - expect(consoleErrorMock.callCount()).to.equal(2); // strict mode renders twice + expect(consoleErrorMock.callCount()).to.equal(1); expect(consoleErrorMock.messages()[0]).to.include( 'Material UI: The `query` argument provided is invalid', );