summary refs log tree commit diff
path: root/api/jest/globalSetup.js
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-23 17:03:36 +0200
committerGitHub <noreply@github.com>2021-09-23 17:03:36 +0200
commit5823f8efb4d1335281b64bfcaddf33bd9453cf08 (patch)
tree08c4420554b707d7207da6c2a9f15b4fcdf87e61 /api/jest/globalSetup.js
parentMerge pull request #394 from ChrisChrome/erlpack-fix (diff)
parent:bug: prepare/postinstall only works for packages not local npm install (diff)
downloadserver-5823f8efb4d1335281b64bfcaddf33bd9453cf08.tar.xz
Merge pull request #372 from fosscord/unittests
Automatic Unittests + documentation
Diffstat (limited to 'api/jest/globalSetup.js')
-rw-r--r--api/jest/globalSetup.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/api/jest/globalSetup.js b/api/jest/globalSetup.js
new file mode 100644

index 00000000..520aa0e2 --- /dev/null +++ b/api/jest/globalSetup.js
@@ -0,0 +1,20 @@ +const { Config, initDatabase } = require("@fosscord/util"); +const fs = require("fs"); +const path = require("path"); +const { FosscordServer } = require("../dist/Server"); +const Server = new FosscordServer({ port: 3001 }); +global.server = Server; +module.exports = async () => { + try { + fs.unlinkSync(path.join(process.cwd(), "database.db")); + } catch {} + + await initDatabase(); + await Config.init(); + Config.get().limits.rate.disabled = true; + return await Server.start(); +}; + +// afterAll(async () => { +// return await Server.stop(); +// });