Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Nov 3, 2020
1 parent c6dc1eb commit a04d880
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions packages/core-data/src/test/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,39 @@ describe( 'getEntityRecords', () => {
} );

it( 'should return the same instance with the same arguments', () => {
const state = deepFreeze( {
let state = deepFreeze( {
entities: {
data: {},
},
} );

const firstRecords = getEntityRecords( state, 'root', 'postType' );
const secondRecords = getEntityRecords( state, 'root', 'postType' );
const postTypeFirstRecords = getEntityRecords(
state,
'root',
'postType'
);
const wpBlockFirstRecords = getEntityRecords(
state,
'postType',
'wp_block'
);

// Simulate update states
state = { ...state };

const postTypeSecondRecords = getEntityRecords(
state,
'root',
'postType'
);
const wpBlockSecondRecords = getEntityRecords(
state,
'postType',
'wp_block'
);

expect( firstRecords ).toBe( secondRecords );
expect( postTypeFirstRecords ).toBe( postTypeSecondRecords );
expect( wpBlockFirstRecords ).toBe( wpBlockSecondRecords );
} );
} );

Expand Down

0 comments on commit a04d880

Please sign in to comment.