diff options
Diffstat (limited to 'api/jest/globalSetup.js')
-rw-r--r-- | api/jest/globalSetup.js | 20 |
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(); +// }); |