-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerateDataProdutos.js
More file actions
29 lines (25 loc) · 881 Bytes
/
generateDataProdutos.js
File metadata and controls
29 lines (25 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const { faker } = require('@faker-js/faker');
const fs = require('fs');
const path = require('path');
// Gerar os dados
const data = [
{
"nome": faker.commerce.productName(),
"preco": faker.commerce.price(),
"descricao": faker.commerce.productDescription(),
"quantidade": faker.number.int({ min: 1, max: 3 }),
"valido": true
},
{
"_id": "hRZeOkwMaN3FJQRL",
"nome": faker.commerce.productName(),
"preco": faker.commerce.price(),
"descricao": faker.commerce.productDescription(),
"quantidade": faker.number.int({ min: 1, max: 3 }),
}
];
// Caminho correto para a pasta fixtures do Cypress
const filePath = path.join(__dirname, 'cypress', 'fixtures', 'dataProdutos.json');
// Escrever o arquivo JSON na pasta fixtures
fs.writeFileSync(filePath, JSON.stringify(data, null, 2));
console.log(`Arquivo JSON gerado em: ${filePath}`);