added unittest setup + ping route test

This commit is contained in:
xnacly
2021-08-18 13:57:23 +02:00
parent 95d7084887
commit cebc19bee2
7 changed files with 6656 additions and 13 deletions
+22
View File
@@ -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");
});
});