This repository was archived by the owner on Feb 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ {"title" :" Mini Cart Block" ,"pageContent" :" <!-- wp:woocommerce/mini-cart /-->" }
Original file line number Diff line number Diff line change 1+ /**
2+ * External dependencies
3+ */
4+ import { switchUserToAdmin , getAllBlocks } from '@wordpress/e2e-test-utils' ;
5+ import { visitBlockPage } from '@woocommerce/blocks-test-utils' ;
6+
7+ /**
8+ * Internal dependencies
9+ */
10+ import { insertBlockDontWaitForInsertClose } from '../../utils.js' ;
11+
12+ const block = {
13+ name : 'Mini Cart' ,
14+ slug : 'woocommerce/mini-cart' ,
15+ class : '.wc-block-mini-cart' ,
16+ } ;
17+
18+ if ( process . env . WOOCOMMERCE_BLOCKS_PHASE < 3 ) {
19+ // eslint-disable-next-line jest/no-focused-tests
20+ test . only ( `skipping ${ block . name } tests` , ( ) => { } ) ;
21+ }
22+
23+ describe ( `${ block . name } Block` , ( ) => {
24+ beforeAll ( async ( ) => {
25+ await switchUserToAdmin ( ) ;
26+ await visitBlockPage ( `${ block . name } Block` ) ;
27+ } ) ;
28+
29+ it ( 'can only be inserted once' , async ( ) => {
30+ await insertBlockDontWaitForInsertClose ( block . name ) ;
31+ expect ( await getAllBlocks ( ) ) . toHaveLength ( 1 ) ;
32+ } ) ;
33+
34+ it ( 'renders without crashing' , async ( ) => {
35+ await expect ( page ) . toRenderBlock ( block ) ;
36+ } ) ;
37+ } ) ;
You can’t perform that action at this time.
0 commit comments