Fail tests when context propTypes validation fails (#5323)

* Fail test when context proptypes validation fails
* Remove isRequired from context propTypes validation

GitOrigin-RevId: c6da5f93672434c0d80be3f659c1fc15dc3dab1f
This commit is contained in:
Alf Eaton 2021-10-08 10:25:13 +01:00 committed by Copybot
parent 4adf32cb43
commit a4799c29b6
2 changed files with 2 additions and 2 deletions

View file

@ -37,7 +37,7 @@ export default function FileViewHeader({ file, storeReferencesKeys }) {
_id: PropTypes.string.isRequired,
})
const { permissionsLevel } = useEditorContext({
permissionsLevel: PropTypes.string.isRequired,
permissionsLevel: PropTypes.string,
})
const { t } = useTranslation()

View file

@ -15,7 +15,7 @@ before(function () {
originalConsoleError(message, ...args)
// Check if the error is from prop-types
if (/Failed prop type/.test(message)) {
if (/Failed (prop|data) type/.test(message)) {
// Throw an error, causing the test to fail
throw new Error(message)
}