Skip to content

Commit

Permalink
Test appearance properties
Browse files Browse the repository at this point in the history
  • Loading branch information
hsingyuc committed Jul 12, 2024
1 parent 0255cd9 commit 3fe78b8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions client/checkout/api/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,33 @@ jest.mock( 'wcpay/utils/checkout', () => ( {
getConfig: jest.fn(),
} ) );

const mockAppearance = {
rules: {
'.Block': {},
'.Input': {},
'.Input--invalid': {},
'.Label': {},
'.Tab': {},
'.Tab--selected': {},
'.Tab:hover': {},
'.TabIcon--selected': {
color: undefined,
},
'.TabIcon:hover': {
color: undefined,
},
'.Text': {},
'.Text--redirect': {},
},
theme: 'stripe',
variables: {
colorBackground: '#ffffff',
colorText: undefined,
fontFamily: undefined,
fontSizeBase: undefined,
},
};

describe( 'WCPayAPI', () => {
test( 'does not initialize woopay if already requesting', async () => {
buildAjaxURL.mockReturnValue( 'https://example.org/' );
Expand All @@ -48,6 +75,7 @@ describe( 'WCPayAPI', () => {
getConfig.mockImplementation( ( key ) => {
const mockProperties = {
initWooPayNonce: 'foo',
appearance: mockAppearance,
order_id: 1,
key: 'testkey',
billing_email: '[email protected]',
Expand All @@ -60,6 +88,7 @@ describe( 'WCPayAPI', () => {

expect( request ).toHaveBeenLastCalledWith( 'https://example.org/', {
_wpnonce: 'foo',
appearance: mockAppearance,
email: '[email protected]',
user_session: 'qwerty123',
order_id: 1,
Expand Down

0 comments on commit 3fe78b8

Please sign in to comment.