Commit 77bbb218016 for woocommerce

commit 77bbb218016abc52060d5cebbbe59b4f48c69170
Author: Ann <annchichi@users.noreply.github.com>
Date:   Tue May 19 12:21:51 2026 +0800

    Improve payment setup fallback coverage (#64860)

diff --git a/plugins/woocommerce/changelog/dev-payment-setup-fallback-tests b/plugins/woocommerce/changelog/dev-payment-setup-fallback-tests
new file mode 100644
index 00000000000..ee4250fb1e7
--- /dev/null
+++ b/plugins/woocommerce/changelog/dev-payment-setup-fallback-tests
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+Improve payment setup fallback test coverage and translator context.
diff --git a/plugins/woocommerce/client/admin/client/settings-payments/components/buttons/enable-gateway-button.tsx b/plugins/woocommerce/client/admin/client/settings-payments/components/buttons/enable-gateway-button.tsx
index 0cf27e59a51..375e2bfcde6 100644
--- a/plugins/woocommerce/client/admin/client/settings-payments/components/buttons/enable-gateway-button.tsx
+++ b/plugins/woocommerce/client/admin/client/settings-payments/components/buttons/enable-gateway-button.tsx
@@ -172,7 +172,7 @@ export const EnableGatewayButton = ( {
 					} else {
 						createErrorNotice(
 							sprintf(
-								/* translators: %s: payment gateway title. */
+								/* translators: %s: payment gateway title, or 'this payment method'. */
 								__(
 									'Finish setting up %s before enabling it.',
 									'woocommerce'
diff --git a/plugins/woocommerce/client/admin/client/settings-payments/components/buttons/test/enable-gateway-button.test.tsx b/plugins/woocommerce/client/admin/client/settings-payments/components/buttons/test/enable-gateway-button.test.tsx
index d0905e719c6..6a53c4127c7 100644
--- a/plugins/woocommerce/client/admin/client/settings-payments/components/buttons/test/enable-gateway-button.test.tsx
+++ b/plugins/woocommerce/client/admin/client/settings-payments/components/buttons/test/enable-gateway-button.test.tsx
@@ -106,39 +106,45 @@ describe( 'EnableGatewayButton', () => {
 		} );
 	} );

-	it( 'falls back to a generic setup message when the gateway title is empty', async () => {
-		const gatewayProviderWithoutTitle = {
-			...gatewayProvider,
-			title: '',
-		} as PaymentGatewayProvider;
-
-		const { getByRole } = render(
-			<EnableGatewayButton
-				gatewayProvider={ gatewayProviderWithoutTitle }
-				settingsHref="/settings/test-gateway"
-				onboardingHref="/onboard/test-gateway"
-				isOffline={ false }
-				gatewayHasRecommendedPaymentMethods={ false }
-				installingPlugin={ null }
-			/>
-		);
-
-		fireEvent.click( getByRole( 'link', { name: 'Enable' } ) );
-
-		await waitFor( () => {
-			expect( mockCreateErrorNotice ).toHaveBeenCalledWith(
-				'Finish setting up this payment method before enabling it.',
-				expect.objectContaining( {
-					type: 'snackbar',
-					explicitDismiss: true,
-					actions: expect.arrayContaining( [
-						expect.objectContaining( {
-							label: 'Manage',
-							url: '/settings/test-gateway',
-						} ),
-					] ),
-				} )
+	it.each( [
+		[ 'empty', '' ],
+		[ 'null', null ],
+	] )(
+		'falls back to a generic setup message when the gateway title is %s',
+		async ( _case, title ) => {
+			const gatewayProviderWithoutTitle = {
+				...gatewayProvider,
+				title,
+			} as unknown as PaymentGatewayProvider;
+
+			const { getByRole } = render(
+				<EnableGatewayButton
+					gatewayProvider={ gatewayProviderWithoutTitle }
+					settingsHref="/settings/test-gateway"
+					onboardingHref="/onboard/test-gateway"
+					isOffline={ false }
+					gatewayHasRecommendedPaymentMethods={ false }
+					installingPlugin={ null }
+				/>
 			);
-		} );
-	} );
+
+			fireEvent.click( getByRole( 'link', { name: 'Enable' } ) );
+
+			await waitFor( () => {
+				expect( mockCreateErrorNotice ).toHaveBeenCalledWith(
+					expect.stringContaining( 'this payment method' ),
+					expect.objectContaining( {
+						type: 'snackbar',
+						explicitDismiss: true,
+						actions: expect.arrayContaining( [
+							expect.objectContaining( {
+								label: 'Manage',
+								url: '/settings/test-gateway',
+							} ),
+						] ),
+					} )
+				);
+			} );
+		}
+	);
 } );