Skip to content

Commit

Permalink
Update the tests that conflicted during rebase.
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenDufresne committed May 19, 2020
1 parent 709bd65 commit c811e0a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -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',
};
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand All @@ -33,30 +32,6 @@ const getContainer = (
};

describe( 'DownloadableBlockHeader', () => {
describe( 'icon rendering', () => {
test( 'should render an <img> tag', () => {
const wrapper = getContainer( pluginWithImg );
expect( wrapper.find( 'img' ).prop( 'src' ) ).toEqual(
pluginWithImg.icon
);
} );

test( 'should render an <img> 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 <BlockIcon/> component', () => {
const wrapper = getContainer( pluginWithIcon );
expect( wrapper.find( BlockIcon ) ).toHaveLength( 1 );
} );
} );

describe( 'user interaction', () => {
test( 'should trigger the onClick function', () => {
const onClickMock = jest.fn();
Expand Down

0 comments on commit c811e0a

Please sign in to comment.