Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian committed Jul 13, 2023
1 parent d05c863 commit 109384e
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions packages/block-editor/src/store/test/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3328,28 +3328,32 @@ describe( 'state', () => {
expect( state.clientIds ).toEqual( [ clientIdOne, clientIdTwo ] );
} );

it( 'should not return client ids of all blocks when inner blocks are replaced with REPLACE_INNER_BLOCKS', () => {
const clientIdOne = '62bfef6e-d5e9-43ba-b7f9-c77cf354141f';
const clientIdTwo = '9db792c6-a25a-495d-adbd-97d56a4c4189';
it( 'should return client ids of the original blocks when inner blocks are replaced with REPLACE_INNER_BLOCKS', () => {
const initialBlocks = deepFreeze( [
'62bfef6e-d5e9-43ba-b7f9-c77cf354141f',
'9db792c6-a25a-495d-adbd-97d56a4c4189',
] );

const action = {
blocks: [
{
clientId: clientIdOne,
clientId: 'afd1cb17-2c08-4e7a-91be-007ba7ddc3a1',
},
{
clientId: clientIdTwo,
clientId: '14501cc2-90a6-4f52-aa36-ab6e896135d1',
},
],
type: 'REPLACE_INNER_BLOCKS',
};

const state = lastBlockInserted( {}, action );
const state = lastBlockInserted(
{
clientIds: initialBlocks,
},
action
);

expect( state.clientIds ).not.toEqual( [
clientIdOne,
clientIdTwo,
] );
expect( state.clientIds ).toEqual( initialBlocks );
} );

it( 'should return empty state if last block inserted is called with action RESET_BLOCKS', () => {
Expand Down

0 comments on commit 109384e

Please sign in to comment.