From 4c7f258fd14ee0aa6d0af0d6b0586f4a7fa3cd34 Mon Sep 17 00:00:00 2001 From: Jorge Date: Mon, 25 Mar 2019 22:30:03 +0000 Subject: [PATCH] Make tests resilient against transforms added by plugins --- .../e2e-tests/specs/block-transforms.test.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/e2e-tests/specs/block-transforms.test.js b/packages/e2e-tests/specs/block-transforms.test.js index 7eae4155ab22fb..d76f546ebc9849 100644 --- a/packages/e2e-tests/specs/block-transforms.test.js +++ b/packages/e2e-tests/specs/block-transforms.test.js @@ -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) @@ -166,10 +172,10 @@ describe( 'Block transforms', () => { ( { originalBlock, availableTransforms }, fixture ) => ( map( availableTransforms, - ( distinationBlock ) => ( [ + ( destinationBlock ) => ( [ originalBlock, fixture, - distinationBlock, + destinationBlock, ] ) ) ) @@ -177,10 +183,10 @@ describe( 'Block transforms', () => { 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(); } );