Skip to content

Commit

Permalink
Add test case for retrieving request status and update text to be cle…
Browse files Browse the repository at this point in the history
…arer.
  • Loading branch information
StevenDufresne committed Jun 8, 2020
1 parent a9791f2 commit 885b1a3
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions packages/block-directory/src/store/test/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe( 'selectors', () => {
} );

describe( 'isRequestingDownloadableBlocks', () => {
it( 'should return false if there are no calls pending', () => {
it( 'should return false if no requests have been made for the block', () => {
const filterValue = 'Awesome Block';

const state = {
Expand All @@ -39,14 +39,35 @@ describe( 'selectors', () => {
expect( isRequesting ).toEqual( false );
} );

it( 'should return true if at least one call is pending', () => {
it( 'should return false if there are no pending requests for the block', () => {
const filterValue = 'Awesome Block';

const state = {
downloadableBlocks: {
[ filterValue ]: {
isRequesting: false,
},
},
};
const isRequesting = isRequestingDownloadableBlocks(
state,
filterValue
);

expect( isRequesting ).toEqual( false );
} );

it( 'should return true if the block has a pending request', () => {
const filterValue = 'Awesome Block';

const state = {
downloadableBlocks: {
[ filterValue ]: {
isRequesting: true,
},
'previous-search-keyword': {
isRequesting: false,
},
},
};
const isRequesting = isRequestingDownloadableBlocks(
Expand Down

0 comments on commit 885b1a3

Please sign in to comment.