diff --git a/packages/block-directory/src/components/downloadable-block-header/test/fixtures/index.js b/packages/block-directory/src/components/downloadable-block-header/test/fixtures/index.js new file mode 100644 index 0000000000000..db09e7df68d30 --- /dev/null +++ b/packages/block-directory/src/components/downloadable-block-header/test/fixtures/index.js @@ -0,0 +1,24 @@ +const pluginBase = { + name: 'boxer/boxer', + title: 'Boxer', + description: + 'Boxer is a Block that puts your WordPress posts into boxes on a page.', + id: 'boxer-block', + rating: 5, + rating_count: 1, + active_installs: 0, + author_block_rating: 5, + author_block_count: '1', + author: 'CK Lee', + assets: [ + 'http://plugins.svn.wordpress.org/boxer-block/trunk/build/index.js', + 'http://plugins.svn.wordpress.org/boxer-block/trunk/build/view.js', + ], + humanized_updated: '3 months ago', +}; + +export const pluginWithIcon = { ...pluginBase, icon: 'block-default' }; +export const pluginWithImg = { + ...pluginBase, + icon: 'https://ps.w.org/listicles/assets/icon-128x128.png', +}; diff --git a/packages/block-directory/src/components/downloadable-block-header/test/index.js b/packages/block-directory/src/components/downloadable-block-header/test/index.js index 3bc26f312e9bc..e23db4dfe8416 100644 --- a/packages/block-directory/src/components/downloadable-block-header/test/index.js +++ b/packages/block-directory/src/components/downloadable-block-header/test/index.js @@ -6,14 +6,13 @@ import { shallow } from 'enzyme'; /** * WordPress dependencies */ -import { BlockIcon } from '@wordpress/block-editor'; import { Button } from '@wordpress/components'; /** * Internal dependencies */ import { DownloadableBlockHeader } from '../index'; -import { pluginWithImg, pluginWithIcon } from './fixtures'; +import { pluginWithIcon } from './fixtures'; const getContainer = ( { icon, title, rating, ratingCount }, @@ -33,30 +32,6 @@ const getContainer = ( }; describe( 'DownloadableBlockHeader', () => { - describe( 'icon rendering', () => { - test( 'should render an tag', () => { - const wrapper = getContainer( pluginWithImg ); - expect( wrapper.find( 'img' ).prop( 'src' ) ).toEqual( - pluginWithImg.icon - ); - } ); - - test( 'should render an tag if icon URL has query string', () => { - const iconURLwithQueryString = - pluginWithImg.icon + '?rev=2011672&test=234234'; - const plugin = { ...pluginWithImg, icon: iconURLwithQueryString }; - const wrapper = getContainer( plugin ); - expect( wrapper.find( 'img' ).prop( 'src' ) ).toEqual( - plugin.icon - ); - } ); - - test( 'should render a component', () => { - const wrapper = getContainer( pluginWithIcon ); - expect( wrapper.find( BlockIcon ) ).toHaveLength( 1 ); - } ); - } ); - describe( 'user interaction', () => { test( 'should trigger the onClick function', () => { const onClickMock = jest.fn();