Added fake data for test and dev environment #17
|
@ -3,6 +3,7 @@
|
||||||
"module": "index.ts",
|
"module": "index.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@faker-js/faker": "^8.3.1",
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
"@types/express-list-endpoints": "^6.0.3",
|
"@types/express-list-endpoints": "^6.0.3",
|
||||||
"@types/jest": "^29.5.11",
|
"@types/jest": "^29.5.11",
|
||||||
|
|
|
@ -1,12 +1,20 @@
|
||||||
import authModel from "../src/models/AuthModel";
|
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 () {
|
export default async function () {
|
||||||
await imageModel.create({
|
const images = faker.helpers.multiple(() => ({
|
||||||
url: "https://example.com",
|
url: faker.helpers.unique(faker.internet.url),
|
||||||
status: "consumed",
|
status: faker.helpers.arrayElement(["available", "unavailable", "consumed"]),
|
||||||
tags: ["2girls", "sleeping"],
|
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({
|
await authModel.create({
|
||||||
app: "tester",
|
app: "tester",
|
||||||
|
|
Loading…
Reference in New Issue