Added fake data for test and dev environment #17
|
@ -3,6 +3,7 @@
|
|||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@faker-js/faker": "^8.3.1",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/express-list-endpoints": "^6.0.3",
|
||||
"@types/jest": "^29.5.11",
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
import authModel from "../src/models/AuthModel";
|
||||
import imageModel from "../src/models/ImageModel";
|
||||
import imageModel, { Image } from "../src/models/ImageModel";
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
export default async function () {
|
||||
await imageModel.create({
|
||||
url: "https://example.com",
|
||||
status: "consumed",
|
||||
tags: ["2girls", "sleeping"],
|
||||
});
|
||||
const images = faker.helpers.multiple(() => ({
|
||||
url: faker.helpers.unique(faker.internet.url),
|
||||
status: faker.helpers.arrayElement(["available", "unavailable", "consumed"]),
|
||||
tags: faker.helpers.arrayElements([
|
||||
"2girls", "sleeping", "touhou",
|
||||
"pokemon", "closed_eyes", "yume_nikki",
|
||||
"waifu", "computer", "party", "yuru_camp"
|
||||
], { min: 0, max: 5 }),
|
||||
}), {count: {min: 5, max:50}});
|
||||
|
||||
// Wait until all images are inserted
|
||||
await Promise.allSettled(images.map(image => imageModel.create(image)));
|
||||
|
||||
await authModel.create({
|
||||
app: "tester",
|
||||
|
|
Loading…
Reference in New Issue