2022-11-09 01:53:26 +00:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2023-08-08 16:58:12 +00:00
|
|
|
import { Products } from '../e2e-jest/fixtures/fixture-data';
|
2022-11-09 01:53:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get products data by key from fixtures.
|
|
|
|
*/
|
2022-11-21 01:08:12 +00:00
|
|
|
export const getFixtureProductsData = ( key = '' ) => {
|
|
|
|
if ( ! key ) {
|
|
|
|
return Products();
|
|
|
|
}
|
2022-11-09 01:53:26 +00:00
|
|
|
return Products()
|
|
|
|
.map( ( product ) => product[ key ] )
|
|
|
|
.filter( Boolean );
|
|
|
|
};
|