This commit is contained in:
Niels Lange 2021-10-11 18:55:38 +07:00 committed by GitHub
parent 494df12859
commit 6286f7fbd6
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1 @@
{"title":"Newest Products Block","pageContent":"<!-- wp:woocommerce/product-new /-->"}

View File

@ -0,0 +1,30 @@
/**
* External dependencies
*/
import { getAllBlocks, switchUserToAdmin } from '@wordpress/e2e-test-utils';
import { visitBlockPage } from '@woocommerce/blocks-test-utils';
import { insertBlockDontWaitForInsertClose } from '../../utils.js';
const block = {
name: 'Newest Products',
slug: 'woocommerce/product-new',
class: '.wc-block-product-new',
};
describe( `${ block.name } Block`, () => {
beforeAll( async () => {
await switchUserToAdmin();
await visitBlockPage( `${ block.name } Block` );
} );
it( 'renders without crashing', async () => {
await expect( page ).toRenderBlock( block );
} );
it( 'can be inserted more than once', async () => {
await insertBlockDontWaitForInsertClose( block.name );
expect( await getAllBlocks() ).toHaveLength( 2 );
} );
} );