crud and http controller

This commit is contained in:
IDONTSUDO 2023-10-26 17:44:54 +03:00
parent cba12be4b1
commit c27c061c15
51 changed files with 930 additions and 387 deletions

View file

@ -1,6 +1,12 @@
import { delay } from "../../src/core/helper/delay.js";
import mongoose from "mongoose";
import { delay } from "../../src/core/helper/delay";
import { Result } from "../../src/core/helper/result";
import { TypedEvent } from "../../src/core/helper/typed_event.js";
import { TypedEvent } from "../../src/core/helper/typed_event";
export const before = async () =>{
await mongoose.connection.dropDatabase()
}
export class TestCore {
allTests = 0;
@ -23,7 +29,7 @@ export class TestCore {
console.log("\x1b[31m", "❌ - " + testName);
};
testResult = () => {
testResult = async () => {
console.log("\x1b[32m", "=============");
if (this.allTests - this.testOk === 0) {
@ -37,6 +43,7 @@ export class TestCore {
console.log("\x1b[31m", "❌ test error:" + String(this.testErr));
console.log("\x1b[32m", `✅ test success! ${this.testOk}`);
}
await before()
};
resultTest = async (
eventClass: TypedEvent<Result<any, any>> | any,