v1.0.0 #28
|
@ -10,6 +10,7 @@
|
|||
"@types/jsonwebtoken": "^9.0.5",
|
||||
"@types/supertest": "^6.0.1",
|
||||
"bun-types": "latest",
|
||||
"enforce-unique": "^1.2.0",
|
||||
"jest": "^29.7.0",
|
||||
"supertest": "^6.3.3",
|
||||
"ts-jest": "^29.1.1"
|
||||
|
|
|
@ -1,34 +1,20 @@
|
|||
import authModel from "../src/models/AuthModel";
|
||||
import imageModel, { Image } from "../src/models/ImageModel";
|
||||
import { faker } from "@faker-js/faker";
|
||||
import { EnforceUniqueError, UniqueEnforcer } from 'enforce-unique';
|
||||
|
||||
const uniqueEnforcer = new UniqueEnforcer();
|
||||
|
||||
export default async function () {
|
||||
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 } }
|
||||
);
|
||||
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)));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
# bun ./bun.lockb --hash: 738A3B3B61512E75-26d27a9609e246ac-33059F282FFA6348-27fd5707ca8843fa
|
||||
# bun ./bun.lockb --hash: 3F45CED80FCAB4BB-3395ac5a537bfe37-601C6F1D91E66F40-076ab920e8127532
|
||||
|
||||
|
||||
"@ampproject/remapping@^2.2.0":
|
||||
|
@ -1291,6 +1291,11 @@ encodeurl@~1.0.2:
|
|||
resolved "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz"
|
||||
integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==
|
||||
|
||||
enforce-unique@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.npmjs.org/enforce-unique/-/enforce-unique-1.2.0.tgz"
|
||||
integrity sha512-ZBusLJB8QQhKMGNOlwARgov+s38rwPbhcifGlhEHqnGHcA8CCSEgbLujdABtpWwZyYnude4t5fviuEmSuV8Hig==
|
||||
|
||||
error-ex@^1.3.1:
|
||||
version "1.3.2"
|
||||
resolved "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz"
|
||||
|
|
Loading…
Reference in New Issue