Skip to content

Commit

Permalink
Add appearance test
Browse files Browse the repository at this point in the history
  • Loading branch information
hsingyuc committed Jul 17, 2024
1 parent 464ade4 commit bf2749f
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,32 @@ describe( 'WoopayExpressCheckoutButton', () => {
const mockRequest = jest.fn().mockResolvedValue( true );
const mockAddToCart = jest.fn().mockResolvedValue( true );
const api = new WCPayAPI( {}, mockRequest );
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,
},
};

beforeEach( () => {
expressCheckoutIframe.mockImplementation( () => jest.fn() );
Expand Down Expand Up @@ -145,6 +171,8 @@ describe( 'WoopayExpressCheckoutButton', () => {
return 'testkey';
case 'order_id':
return 1;
case 'appearance':
return mockAppearance;
default:
return 'foo';
}
Expand All @@ -170,6 +198,7 @@ describe( 'WoopayExpressCheckoutButton', () => {
order_id: 1,
key: 'testkey',
billing_email: '[email protected]',
appearance: mockAppearance,
} );
expect( expressCheckoutIframe ).not.toHaveBeenCalled();
} );
Expand Down

0 comments on commit bf2749f

Please sign in to comment.