This commit is contained in:
Alex Florisca 2022-09-30 02:38:34 +01:00 committed by GitHub
parent c360c5654a
commit 4a82b73baf
1 changed files with 5 additions and 3 deletions

View File

@ -66,15 +66,17 @@ describe( 'Checkout registry', () => {
.mockImplementation( () => {} );
const error = new Error( 'test error' );
// We use this new filter name here to avoid return the cached value for the filter
const filterNameThatThrows = 'throw';
const value = 'Hello World';
__experimentalRegisterCheckoutFilters( filterName, {
[ filterName ]: () => {
__experimentalRegisterCheckoutFilters( filterNameThatThrows, {
[ filterNameThatThrows ]: () => {
throw error;
},
} );
const { result: newValue } = renderHook( () =>
__experimentalApplyCheckoutFilter( {
filterName,
filterName: filterNameThatThrows,
defaultValue: value,
} )
);