From 0ecc5d8c0e353676e9f5bdbc724bb33572d3b572 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Fri, 27 Aug 2021 11:10:42 +0200 Subject: :construction: api --- api/scripts/setup_test.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 api/scripts/setup_test.js (limited to 'api/scripts/setup_test.js') diff --git a/api/scripts/setup_test.js b/api/scripts/setup_test.js new file mode 100644 index 00000000..4b692f7c --- /dev/null +++ b/api/scripts/setup_test.js @@ -0,0 +1 @@ +// TODO: start api -- cgit 1.5.1 From 9e4c7d119b3feb7a9d63a31c162b88b6839d75f9 Mon Sep 17 00:00:00 2001 From: xnacly Date: Mon, 30 Aug 2021 16:21:54 +0200 Subject: added setup for jest tests --- api/jest/setup.js | 2 ++ api/package.json | 2 +- api/scripts/setup_test.js | 14 +++++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 api/jest/setup.js (limited to 'api/scripts/setup_test.js') diff --git a/api/jest/setup.js b/api/jest/setup.js new file mode 100644 index 00000000..abc485ae --- /dev/null +++ b/api/jest/setup.js @@ -0,0 +1,2 @@ +jest.spyOn(global.console, "log").mockImplementation(() => jest.fn()); +jest.spyOn(global.console, "info").mockImplementation(() => jest.fn()); diff --git a/api/package.json b/api/package.json index ff9efa52..b8bb4d45 100644 --- a/api/package.json +++ b/api/package.json @@ -85,7 +85,7 @@ "typeorm": "^0.2.37" }, "jest": { - "setupFilesAfterEnv": [ + "setupFiles": [ "/jest/setup.js", "/scripts/setup_test.js" ], diff --git a/api/scripts/setup_test.js b/api/scripts/setup_test.js index 4b692f7c..95bf2e40 100644 --- a/api/scripts/setup_test.js +++ b/api/scripts/setup_test.js @@ -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(); +// }); -- cgit 1.5.1