summary refs log tree commit diff
path: root/api/tests
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-01 10:47:00 +0200
committerGitHub <noreply@github.com>2021-09-01 10:47:00 +0200
commitdf1d633c4b56bea97e0b76da34171d80c0c6a3ff (patch)
tree7e57837ec000a641935a32649ac17b38ef2e29d8 /api/tests
parentMerge pull request #287 from EMREOYUN/patch-1 (diff)
parentMerge pull request #299 from AlTech98/typeorm (diff)
downloadserver-df1d633c4b56bea97e0b76da34171d80c0c6a3ff.tar.xz
Merge pull request #300 from fosscord/typeorm
Diffstat (limited to 'api/tests')
-rw-r--r--api/tests/routes/auth/login.test.js.disabled2
-rw-r--r--api/tests/routes/auth/register.test.js25
-rw-r--r--api/tests/routes/ping.test.js12
3 files changed, 39 insertions, 0 deletions
diff --git a/api/tests/routes/auth/login.test.js.disabled b/api/tests/routes/auth/login.test.js.disabled
new file mode 100644

index 00000000..f677cebd --- /dev/null +++ b/api/tests/routes/auth/login.test.js.disabled
@@ -0,0 +1,2 @@ +const supertest = require("supertest"); +const request = supertest("http://localhost:1870"); diff --git a/api/tests/routes/auth/register.test.js b/api/tests/routes/auth/register.test.js new file mode 100644
index 00000000..f42f004a --- /dev/null +++ b/api/tests/routes/auth/register.test.js
@@ -0,0 +1,25 @@ +const supertest = require("supertest"); +const request = supertest("http://localhost:3001"); + +describe("/api/register", () => { + describe("POST", () => { + test("without body", async () => { + const response = await request.post("/api/auth/register").send({}); + expect(response.statusCode).toBe(400); + }); + test("with body", async () => { + const response = await request.post("/api/auth/register").send({ + fingerprint: "805826570869932034.wR8vi8lGlFBJerErO9LG5NViJFw", + email: "qo8etzvaf@gmail.com", + username: "qp39gr98", + password: "wtp9gep9gw", + invite: null, + consent: true, + date_of_birth: "2000-04-04", + gift_code_sku_id: null, + captcha_key: null + }); + expect(response.statusCode).toBe(200); + }); + }); +}); diff --git a/api/tests/routes/ping.test.js b/api/tests/routes/ping.test.js new file mode 100644
index 00000000..6fa4b160 --- /dev/null +++ b/api/tests/routes/ping.test.js
@@ -0,0 +1,12 @@ +const supertest = require("supertest"); +const request = supertest("http://localhost:3001"); + +describe("/ping", () => { + describe("GET", () => { + test("should return 200 and pong", async () => { + let response = await request.get("/api/ping"); + expect(response.text).toBe("pong"); + expect(response.statusCode).toBe(200); + }); + }); +});