diff --git a/plugins/woocommerce-blocks/packages/checkout/filter-registry/test/index.js b/plugins/woocommerce-blocks/packages/checkout/filter-registry/test/index.js index 097b455a5a7..0bff625320c 100644 --- a/plugins/woocommerce-blocks/packages/checkout/filter-registry/test/index.js +++ b/plugins/woocommerce-blocks/packages/checkout/filter-registry/test/index.js @@ -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, } ) );