Skip to content

Commit 835025e

Browse files
authored
Merge pull request #258 from Progi1984/fixFakerSearch
`FakerSearchTag` : Use only products from last version of PrestaShop
2 parents 1b1771e + a792bc6 commit 835025e

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

src/data/demo/products.ts

+1
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ export default {
247247
}),
248248
// Products demo for PS version <= 1.7.2
249249
//@todo : to find for a solution in case of upgrade 1.7.2 to 1.7.8
250+
//@todo : Clean FakerCartRule & FakerSearchTag
250251
old_demo_1: new FakerProduct({
251252
id: 1,
252253
name: 'Faded Short Sleeves T-shirt',

src/data/faker/cartRule.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ import type {
1010

1111
import {faker} from '@faker-js/faker';
1212

13-
const productsNames: string[] = Object.values(dataProducts).map((product: FakerProduct) => product.name);
13+
const productsNames: string[] = Object.entries(dataProducts)
14+
.map((value: [string, FakerProduct]) => {
15+
if (value[0].startsWith('old_')) {
16+
return '';
17+
}
18+
return value[1].name;
19+
})
20+
.filter((value: string) => value !== '');
1421

1522
/**
1623
* Create new cart rule to use on creation cart rule form on BO

src/data/faker/searchTag.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ import SearchTagCreator from '@data/types/searchTag';
66

77
import {faker} from '@faker-js/faker';
88

9-
const productsNames: string[] = Object.values(dataProducts).map((product: FakerProduct) => product.name);
9+
const productsNames: string[] = Object.entries(dataProducts)
10+
.map((value: [string, FakerProduct]) => {
11+
if (value[0].startsWith('old_')) {
12+
return '';
13+
}
14+
return value[1].name;
15+
})
16+
.filter((value: string) => value !== '');
1017
const languagesNames: string[] = Object.values(dataLanguages).map((language: FakerLanguage) => language.name);
1118

1219
/**

0 commit comments

Comments
 (0)