Bläddra i källkod

added fake data

pull/1/head
Lazar Kostic 3 år sedan
förälder
incheckning
8a40ac99ee
3 ändrade filer med 29 tillägg och 0 borttagningar
  1. 23
    0
      db/db.ts
  2. 1
    0
      package.json
  3. 5
    0
      yarn.lock

+ 23
- 0
db/db.ts Visa fil

@@ -0,0 +1,23 @@
import { faker } from '@faker-js/faker'

interface FakeData {
id: number;
name: string;
color: string;
price: string;
company: string;
}

module.exports = () => {
const items:FakeData[] = [];
for (let id = 1; id <= 500; id++) {
items.push({
id: id,
name: `${faker.commerce.productAdjective()} ${faker.commerce.productMaterial()} ${faker.commerce.product()}`,
color: faker.commerce.color(),
price: `$${faker.commerce.price()}`,
company: faker.company.companyName(),
});
}
return { items };
};

+ 1
- 0
package.json Visa fil

@@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@faker-js/faker": "^7.6.0",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.0.0",
"@testing-library/user-event": "^13.2.1",

+ 5
- 0
yarn.lock Visa fil

@@ -1205,6 +1205,11 @@
minimatch "^3.1.2"
strip-json-comments "^3.1.1"

"@faker-js/faker@^7.6.0":
version "7.6.0"
resolved "https://registry.yarnpkg.com/@faker-js/faker/-/faker-7.6.0.tgz#9ea331766084288634a9247fcd8b84f16ff4ba07"
integrity sha512-XK6BTq1NDMo9Xqw/YkYyGjSsg44fbNwYRx7QK2CuoQgyy+f1rrTDHoExVM5PsyXCtfl2vs2vVJ0MN0yN6LppRw==

"@humanwhocodes/config-array@^0.11.6":
version "0.11.7"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.7.tgz#38aec044c6c828f6ed51d5d7ae3d9b9faf6dbb0f"

Laddar…
Avbryt
Spara