diff options
author | xnacly <matteogropp@protonmail.com> | 2021-08-18 13:57:23 +0200 |
---|---|---|
committer | xnacly <matteogropp@protonmail.com> | 2021-08-18 13:57:23 +0200 |
commit | cebc19bee289470ca8d3d68387c648bf48a3b055 (patch) | |
tree | 60c9f7b6d8400366accc3cadc0ce2d736874caae /cdn/tests/start.test.js | |
parent | :bug: fix #267 (diff) | |
download | server-cebc19bee289470ca8d3d68387c648bf48a3b055.tar.xz |
added unittest setup + ping route test
Diffstat (limited to 'cdn/tests/start.test.js')
-rw-r--r-- | cdn/tests/start.test.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cdn/tests/start.test.js b/cdn/tests/start.test.js new file mode 100644 index 00000000..348405de --- /dev/null +++ b/cdn/tests/start.test.js @@ -0,0 +1,22 @@ +const { CDNServer } = require("../dist/Server"); +const { db } = require("@fosscord/util"); +const supertest = require("supertest"); +const request = supertest("http://localhost:3003"); +const server = new CDNServer({ port: Number(process.env.PORT) || 3003 }); + +beforeAll(async () => { + await server.start(); + db.close(); + return server; +}); + +afterAll(() => { + return server.stop(); +}); + +describe("GET /ping", () => { + test("should return pong", async () => { + const response = await request.get("/ping"); + expect(response.text).toBe("pong"); + }); +}); |