summary refs log tree commit diff
path: root/cdn/tests/start.test.js
blob: 348405ded7c00fc78f831533dd1dfaf7ed8b0a62 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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");
	});
});