Skip to content

Commit

Permalink
Use addBlockStyles in reducer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed May 13, 2024
1 parent b40ca17 commit cf7ac41
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions packages/blocks/src/store/test/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
addBlockVariations,
addBlockTypes,
removeBlockVariations,
addBlockStyles,
} from '../actions';
import {
unprocessedBlockTypes,
Expand Down Expand Up @@ -111,21 +112,19 @@ describe( 'blockStyles', () => {
it( 'should add new block styles for a single block type', () => {
const original = deepFreeze( {} );

let state = blockStyles( original, {
type: 'ADD_BLOCK_STYLES',
blockNames: [ blockName ],
styles: [ { name: 'fancy' } ],
} );
let state = blockStyles(
original,
addBlockStyles( blockName, [ { name: 'fancy' } ] )
);

expect( state ).toEqual( {
[ blockName ]: [ { name: 'fancy' } ],
} );

state = blockStyles( state, {
type: 'ADD_BLOCK_STYLES',
blockNames: [ blockName ],
styles: [ { name: 'lightbox' } ],
} );
state = blockStyles(
state,
addBlockStyles( blockName, [ { name: 'lightbox' } ] )
);

expect( state ).toEqual( {
[ blockName ]: [ { name: 'fancy' }, { name: 'lightbox' } ],
Expand All @@ -135,22 +134,23 @@ describe( 'blockStyles', () => {
it( 'should add block styles for array of block types', () => {
const original = deepFreeze( {} );

let state = blockStyles( original, {
type: 'ADD_BLOCK_STYLES',
blockNames: [ 'core/group', 'core/columns' ],
styles: [ { name: 'dark' } ],
} );
let state = blockStyles(
original,
addBlockStyles(
[ 'core/group', 'core/columns' ],
[ { name: 'dark' } ]
)
);

expect( state ).toEqual( {
'core/group': [ { name: 'dark' } ],
'core/columns': [ { name: 'dark' } ],
} );

state = blockStyles( state, {
type: 'ADD_BLOCK_STYLES',
blockNames: [ 'core/group' ],
styles: [ { name: 'light' } ],
} );
state = blockStyles(
state,
addBlockStyles( [ 'core/group' ], [ { name: 'light' } ] )
);

expect( state ).toEqual( {
'core/group': [ { name: 'dark' }, { name: 'light' } ],
Expand Down

0 comments on commit cf7ac41

Please sign in to comment.