Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wjrosa committed Nov 26, 2024
1 parent 786ae1c commit c4eadd2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
28 changes: 14 additions & 14 deletions client/data/settings/__tests__/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import {
useSettings,
useGetOrderedPaymentMethodIds,
useCustomizePaymentMethodSettings,
usePaymentRequestEnabledSettings,
usePaymentRequestButtonTheme,
usePaymentRequestLocations,
usePaymentRequestButtonSize,
usePaymentRequestButtonType,
useIsStripeEnabled,
useTestMode,
useSavedCards,
useSeparateCardForm,
useIsShortAccountStatementEnabled,
useDebugLog,
useManualCapture,
useExpressCheckoutButtonLocations,
useExpressCheckoutEnabledSettings,
useExpressCheckoutButtonSize,
useExpressCheckoutButtonType,
useExpressCheckoutButtonTheme,
} from '../hooks';
import { STORE_NAME } from '../../constants';

Expand Down Expand Up @@ -223,25 +223,25 @@ describe( 'Settings hooks tests', () => {
fallbackValue: [],
},
usePaymentRequestEnabledSettings: {
hook: usePaymentRequestEnabledSettings,
hook: useExpressCheckoutEnabledSettings,
storeKey: 'is_express_checkout_enabled',
testedValue: true,
fallbackValue: false,
},
usePaymentRequestButtonSize: {
hook: usePaymentRequestButtonSize,
useExpressCheckoutButtonSize: {
hook: useExpressCheckoutButtonSize,
storeKey: 'express_checkout_button_size',
testedValue: 'large',
fallbackValue: '',
},
usePaymentRequestButtonType: {
hook: usePaymentRequestButtonType,
useExpressCheckoutButtonType: {
hook: useExpressCheckoutButtonType,
storeKey: 'express_checkout_button_type',
testedValue: '',
fallbackValue: '',
},
usePaymentRequestButtonTheme: {
hook: usePaymentRequestButtonTheme,
useExpressCheckoutButtonTheme: {
hook: useExpressCheckoutButtonTheme,
storeKey: 'express_checkout_button_theme',
testedValue: 'dark',
fallbackValue: '',
Expand Down Expand Up @@ -288,8 +288,8 @@ describe( 'Settings hooks tests', () => {
testedValue: true,
fallbackValue: false,
},
usePaymentRequestLocations: {
hook: usePaymentRequestLocations,
useExpressCheckoutLocations: {
hook: useExpressCheckoutButtonLocations,
storeKey: 'express_checkout_button_locations',
testedValue: [ 'checkout', 'cart' ],
fallbackValue: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {

jest.mock( 'wcstripe/data', () => ( {
useExpressCheckoutEnabledSettings: jest.fn(),
useExpressCheckoutLocations: jest.fn(),
useExpressCheckoutButtonLocations: jest.fn(),
useExpressCheckoutButtonType: jest.fn().mockReturnValue( [ 'buy' ] ),
useExpressCheckoutButtonSize: jest.fn().mockReturnValue( [ 'default' ] ),
useExpressCheckoutButtonTheme: jest.fn().mockReturnValue( [ 'dark' ] ),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global wc_stripe_payment_request_settings_params */
/* global wc_stripe_express_checkout_params */

import { __ } from '@wordpress/i18n';
import { useState, useMemo } from 'react';
Expand All @@ -18,8 +18,8 @@ const ExpressCheckoutPreviewComponent = ( { buttonType, theme, size } ) => {

/* eslint-disable camelcase */
const stripePromise = useMemo( () => {
return loadStripe( wc_stripe_payment_request_settings_params.key, {
locale: wc_stripe_payment_request_settings_params.locale,
return loadStripe( wc_stripe_express_checkout_params.key, {
locale: wc_stripe_express_checkout_params.locale,
} );
}, [] );
/* eslint-enable camelcase */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function admin_scripts() {
];
wp_localize_script(
'wc-stripe-payment-request-settings',
'wc_stripe_payment_request_settings_params',
'wc_express_checkout_params',
$params
);

Expand Down

0 comments on commit c4eadd2

Please sign in to comment.