added setup for jest tests

This commit is contained in:
xnacly 2021-08-30 16:21:54 +02:00
parent 5e2dd88908
commit 9e4c7d119b
3 changed files with 16 additions and 2 deletions

2
api/jest/setup.js Normal file
View File

@ -0,0 +1,2 @@
jest.spyOn(global.console, "log").mockImplementation(() => jest.fn());
jest.spyOn(global.console, "info").mockImplementation(() => jest.fn());

View File

@ -85,7 +85,7 @@
"typeorm": "^0.2.37" "typeorm": "^0.2.37"
}, },
"jest": { "jest": {
"setupFilesAfterEnv": [ "setupFiles": [
"<rootDir>/jest/setup.js", "<rootDir>/jest/setup.js",
"<rootDir>/scripts/setup_test.js" "<rootDir>/scripts/setup_test.js"
], ],

View File

@ -1 +1,13 @@
// TODO: start api const fs = require("fs");
const { FosscordServer } = require("../dist/Server");
const Server = new FosscordServer({ port: 3001 });
(async () => {
try {
fs.unlinkSync(`${__dirname}/database.db`);
} catch {}
return await Server.start();
})();
// afterAll(async () => {
// return await Server.stop();
// });