formatting code upload project instance to files

This commit is contained in:
IDONTSUDO 2023-11-28 18:34:41 +03:00
parent ce4c98ff13
commit a0b4f00f47
65 changed files with 399 additions and 748 deletions

View file

@ -3,10 +3,9 @@ import { delay } from "../../src/core/helper/delay";
import { Result } from "../../src/core/helper/result";
import { TypedEvent } from "../../src/core/helper/typed_event";
export const before = async () =>{
await mongoose.connection.dropDatabase()
}
export const before = async () => {
await mongoose.connection.dropDatabase();
};
export class TestCore {
allTests = 0;
@ -33,17 +32,14 @@ export class TestCore {
console.log("\x1b[32m", "=============");
if (this.allTests - this.testOk === 0) {
console.log(
"\x1b[32m",
`✅ All test success! ${this.allTests}/${this.testOk}`
);
console.log("\x1b[32m", `✅ All test success! ${this.allTests}/${this.testOk}`);
return;
}
if (this.testErr !== 0) {
console.log("\x1b[31m", "❌ test error:" + String(this.testErr));
console.log("\x1b[32m", `✅ test success! ${this.testOk}`);
}
await before()
await before();
};
resultTest = async (
eventClass: TypedEvent<Result<any, any>> | any,
@ -54,24 +50,20 @@ export class TestCore {
) => {
let testIsOk = false;
eventClass.call(...args);
const listener = eventClass.on(
(e: {
fold: (arg0: (_s: any) => void, arg1: (_e: any) => void) => void;
}) => {
e.fold(
() => {
if (isOk) {
testIsOk = true;
}
},
() => {
if (!isOk) {
testIsOk = true;
}
const listener = eventClass.on((e: { fold: (arg0: (_s: any) => void, arg1: (_e: any) => void) => void }) => {
e.fold(
() => {
if (isOk) {
testIsOk = true;
}
);
}
);
},
() => {
if (!isOk) {
testIsOk = true;
}
}
);
});
await delay(delayTime);
this.assert(testIsOk, testName);
listener.dispose();