woocommerce/plugins/woocommerce-blocks/tests/e2e-tests/specs/backend/cart.test.js

31 lines
648 B
JavaScript

/**
* External dependencies
*/
import {
insertBlock,
getEditedPostContent,
getAllBlocks,
createNewPost,
switchUserToAdmin,
} from '@wordpress/e2e-test-utils';
describe( 'Cart Block', () => {
beforeEach( async () => {
await switchUserToAdmin();
await createNewPost();
} );
it( 'can be created', async () => {
await insertBlock( 'Cart' );
expect( await getEditedPostContent() ).toMatchSnapshot();
} );
it( 'can only be inserted once', async () => {
await insertBlock( 'Cart' );
expect( await getAllBlocks() ).toHaveLength( 1 );
await insertBlock( 'Cart' );
expect( await getAllBlocks() ).toHaveLength( 1 );
} );
} );