Add test for coupon meta data to API test.

This commit is contained in:
Jeff Stieler 2021-11-30 15:19:01 -05:00
parent 4366de753e
commit 21f6ea6ae5
1 changed files with 12 additions and 0 deletions

View File

@ -312,6 +312,18 @@ describe( 'Coupons API tests', () => {
expect( status ).toEqual( ordersApi.create.responseCode ); expect( status ).toEqual( ordersApi.create.responseCode );
expect( body.coupon_lines ).toHaveLength( 1 ); expect( body.coupon_lines ).toHaveLength( 1 );
expect( body.coupon_lines[ 0 ].code ).toEqual( testCoupon.code ); expect( body.coupon_lines[ 0 ].code ).toEqual( testCoupon.code );
// Test that the coupon meta data exists.
// See: https://github.com/woocommerce/woocommerce/issues/28166.
expect( body.coupon_lines[ 0 ].meta_data ).toEqual(
expect.arrayContaining( [
expect.objectContaining( {
key: 'coupon_data',
value: expect.objectContaining( {
code: testCoupon.code,
} ),
} ),
] )
);
} ); } );
} ); } );
} ); } );