From 4a82b73baf29ddfe024a881d45fb725144c5bbbb Mon Sep 17 00:00:00 2001 From: Alex Florisca Date: Fri, 30 Sep 2022 02:38:34 +0100 Subject: [PATCH] Fix failing filter test (https://github.com/woocommerce/woocommerce-blocks/pull/7253) --- .../packages/checkout/filter-registry/test/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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, } ) );