36 lines
924 B
JavaScript
36 lines
924 B
JavaScript
/**
|
|
* This file can be used to load-test the application
|
|
*/
|
|
|
|
import { writeFileSync } from "fs";
|
|
|
|
// Temporary file to generate demo data for the inventory
|
|
const inventoryItems = [];
|
|
|
|
// Function to add an item to the inventory using a simple function
|
|
function addInventoryItem(name, amount, manufacturer, category, sku) {
|
|
const item = {
|
|
name: name,
|
|
amount: amount,
|
|
manufacturer: manufacturer,
|
|
category: category,
|
|
sku: sku
|
|
};
|
|
|
|
inventoryItems.push(item);
|
|
}
|
|
|
|
// Loop to generate 2000 items
|
|
for (let i = 1; i <= 1024; i++) {
|
|
const itemName = `Item ${i}`;
|
|
const itemAmount = Math.floor(Math.random() * 100) + 1;
|
|
const itemManufacturer = `Manufacturer ${i}`;
|
|
const itemCategory = `Category ${i}`;
|
|
const itemSKU = `SKU-${i}`;
|
|
|
|
addInventoryItem(itemName, itemAmount, itemManufacturer, itemCategory, itemSKU);
|
|
}
|
|
|
|
// Save the generated data to a file
|
|
writeFileSync('demoData.json', JSON.stringify(inventoryItems))
|