Skip to content

Commit

Permalink
Make tests resilient against transforms added by plugins (#14632)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta authored Mar 29, 2019
1 parent fd72892 commit 39171ca
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/e2e-tests/specs/block-transforms.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,13 @@ const getTransformResult = async ( blockContent, transformName ) => {
return getEditedPostContent();
};

describe( 'Block transforms', () => {
// Skipping all the tests when plugins are enabled
// makes sure the tests are not executed, and no unused snapshots errors are thrown.
const maybeDescribe = process.env.POPULAR_PLUGINS ?
describe :
describe.skip;

maybeDescribe( 'Block transforms', () => {
// Todo: Remove the filter as soon as all fixtures are corrected,
// and its direct usage on the editor does not trigger errors.
// Currently some fixtures trigger errors (mainly media related)
Expand Down Expand Up @@ -166,21 +172,21 @@ describe( 'Block transforms', () => {
( { originalBlock, availableTransforms }, fixture ) => (
map(
availableTransforms,
( distinationBlock ) => ( [
( destinationBlock ) => ( [
originalBlock,
fixture,
distinationBlock,
destinationBlock,
] )
)
)
);

it.each( testTable )(
'block %s in fixture %s into the %s block',
async ( originalBlock, fixture, distinationBlock ) => {
async ( originalBlock, fixture, destinationBlock ) => {
const { content } = transformStructure[ fixture ];
expect(
await getTransformResult( content, distinationBlock )
await getTransformResult( content, destinationBlock )
).toMatchSnapshot();
}
);
Expand Down

0 comments on commit 39171ca

Please sign in to comment.