From ad95f9ffee982eba6684793923c24183d096ca59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20=28Greg=29=20Zi=C3=B3=C5=82kowski?= Date: Wed, 16 May 2018 10:16:31 +0200 Subject: [PATCH] Tests: Add missing unit test for received entity records (#6770) --- core-data/test/reducer.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/core-data/test/reducer.js b/core-data/test/reducer.js index f38eaa42640fc..60b4564d14f91 100644 --- a/core-data/test/reducer.js +++ b/core-data/test/reducer.js @@ -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' }, + }, + } ); + } ); } );