diff --git a/packages/editor/src/components/media-placeholder/index.js b/packages/editor/src/components/media-placeholder/index.js
index 4334aa3b5a2d2..c1b64eb0d9a64 100644
--- a/packages/editor/src/components/media-placeholder/index.js
+++ b/packages/editor/src/components/media-placeholder/index.js
@@ -52,7 +52,7 @@ const InsertFromURLPopover = ( { src, onChange, onSubmit, onClose } ) => (
);
-class MediaPlaceholder extends Component {
+export class MediaPlaceholder extends Component {
constructor() {
super( ...arguments );
this.state = {
@@ -258,13 +258,10 @@ class MediaPlaceholder extends Component {
}
const applyWithSelect = withSelect( ( select ) => {
- let hasUploadPermissions = false;
- if ( undefined !== select( 'core' ) ) {
- hasUploadPermissions = select( 'core' ).hasUploadPermissions();
- }
+ const { hasUploadPermissions } = select( 'core' );
return {
- hasUploadPermissions: hasUploadPermissions,
+ hasUploadPermissions: hasUploadPermissions(),
};
} );
diff --git a/packages/editor/src/components/media-placeholder/test/index.js b/packages/editor/src/components/media-placeholder/test/index.js
index f8b266b71b5fd..6d7050eb84f06 100644
--- a/packages/editor/src/components/media-placeholder/test/index.js
+++ b/packages/editor/src/components/media-placeholder/test/index.js
@@ -6,12 +6,14 @@ import { mount } from 'enzyme';
/**
* Internal dependencies
*/
-import MediaPlaceholder from '../';
+import { MediaPlaceholder } from '../';
+
+jest.mock( '../../media-upload/check', () => () => null );
describe( 'MediaPlaceholder', () => {
it( 'renders successfully when allowedTypes property is not specified', () => {
expect( () => mount(
-
+
) ).not.toThrow();
} );
} );
diff --git a/packages/editor/src/components/media-upload/check.js b/packages/editor/src/components/media-upload/check.js
index 13f9fac617f5a..d72b48497e0af 100644
--- a/packages/editor/src/components/media-upload/check.js
+++ b/packages/editor/src/components/media-upload/check.js
@@ -8,12 +8,9 @@ export function MediaUploadCheck( { hasUploadPermissions, fallback = null, child
}
export default withSelect( ( select ) => {
- let hasUploadPermissions = false;
- if ( undefined !== select( 'core' ) ) {
- hasUploadPermissions = select( 'core' ).hasUploadPermissions();
- }
+ const { hasUploadPermissions } = select( 'core' );
return {
- hasUploadPermissions: hasUploadPermissions,
+ hasUploadPermissions: hasUploadPermissions(),
};
} )( MediaUploadCheck );