Skip to content

Commit

Permalink
Try calling request.continue to finalise request
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Mar 25, 2022
1 parent 904b425 commit a624392
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/e2e-tests/specs/editor/blocks/navigation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,14 +360,16 @@ describe( 'Navigation', () => {
request.url().includes( `rest_route` ) &&
request.url().includes( `navigation` ) &&
request.url().includes( testNavId ),
onRequestMatch: () => {
onRequestMatch: ( request ) => {
// The Promise simulates a REST API request whose resolultion
// the test has full control over.
return new Promise( ( resolve ) => {
// Assign the resolution function to the var in the
// upper scope to afford control over resolution.
resolveNavigationRequest = resolve;
} );

// Call request.continue() is required to fully resolve the mock.
} ).then( () => request.continue() );
},
},
] );
Expand Down Expand Up @@ -411,14 +413,16 @@ describe( 'Navigation', () => {
request.url().includes( `rest_route` ) &&
request.url().includes( `navigation` ) &&
request.url().includes( testNavId ),
onRequestMatch: () => {
onRequestMatch: ( request ) => {
// The Promise simulates a REST API request whose resolultion
// the test has full control over.
return new Promise( ( resolve ) => {
// Assign the resolution function to the var in the
// upper scope to afford control over resolution.
resolveNavigationRequest = resolve;
} );

// Call request.continue() is required to fully resolve the mock.
} ).then( () => request.continue() );
},
},
] );
Expand Down

0 comments on commit a624392

Please sign in to comment.