Skip to content

Commit

Permalink
Tests: Add missing unit test for received entity records (#6770)
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo authored May 16, 2018
1 parent 75f283a commit ad95f9f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions core-data/test/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,29 @@ describe( 'entities', () => {
},
} );
} );

it( 'appends the received post types by slug', () => {
const originalState = deepFreeze( {
root: {
postType: {
byKey: {
w: { slug: 'w', title: 'water' },
},
},
},
} );
const state = entities( originalState, {
type: 'RECEIVE_ENTITY_RECORDS',
records: [ { slug: 'b', title: 'beach' } ],
kind: 'root',
name: 'postType',
} );

expect( state.root.postType ).toEqual( {
byKey: {
w: { slug: 'w', title: 'water' },
b: { slug: 'b', title: 'beach' },
},
} );
} );
} );

0 comments on commit ad95f9f

Please sign in to comment.