From b19dea31d5be040d228aa57bfdb6ab3db8323a37 Mon Sep 17 00:00:00 2001 From: Alie Date: Fri, 12 Jan 2024 16:14:29 +0100 Subject: [PATCH] fmt --- tests/populateDatabase.ts | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/tests/populateDatabase.ts b/tests/populateDatabase.ts index 041f830..ab21f45 100644 --- a/tests/populateDatabase.ts +++ b/tests/populateDatabase.ts @@ -1,20 +1,37 @@ import authModel from "../src/models/AuthModel"; -import imageModel, { Image } from "../src/models/ImageModel"; +import imageModel from "../src/models/ImageModel"; import { faker } from "@faker-js/faker"; -import { EnforceUniqueError, UniqueEnforcer } from 'enforce-unique'; +import { UniqueEnforcer } from "enforce-unique"; const uniqueEnforcer = new UniqueEnforcer(); export default async function () { - const images = faker.helpers.multiple(() => ({ - url: uniqueEnforcer.enforce(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}}); + const images = faker.helpers.multiple( + () => ({ + url: uniqueEnforcer.enforce(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)));