woocommerce/plugins/woocommerce-blocks/tests/utils/get-fixture-products-data.ts

17 lines
327 B
TypeScript
Raw Normal View History

/**
* Internal dependencies
*/
import { Products } from '../e2e-jest/fixtures/fixture-data';
/**
* Get products data by key from fixtures.
*/
export const getFixtureProductsData = ( key = '' ) => {
if ( ! key ) {
return Products();
}
return Products()
.map( ( product ) => product[ key ] )
.filter( Boolean );
};