summary refs log tree commit diff
path: root/api/tests/routes/auth/register.test.js
diff options
context:
space:
mode:
authorxnacly <matteogropp@protonmail.com>2021-08-30 16:23:19 +0200
committerxnacly <matteogropp@protonmail.com>2021-08-30 16:23:19 +0200
commit0c777a86f35fd4555a6f8b42c6a06a5038b2d666 (patch)
tree6f1b394cd680e299a5334433ff7ad4e9878c3723 /api/tests/routes/auth/register.test.js
parentadded setup for jest tests (diff)
downloadserver-0c777a86f35fd4555a6f8b42c6a06a5038b2d666.tar.xz
added first unittests for api endpoints
Diffstat (limited to 'api/tests/routes/auth/register.test.js')
-rw-r--r--api/tests/routes/auth/register.test.js25
1 files changed, 25 insertions, 0 deletions
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); + }); + }); +});