summary refs log tree commit diff
path: root/cdn
diff options
context:
space:
mode:
authorxnacly <matteogropp@protonmail.com>2021-08-18 19:29:16 +0200
committerxnacly <matteogropp@protonmail.com>2021-08-18 19:29:16 +0200
commitd95aa0c51ad7b9d02f5a0104d6edd64982895c9a (patch)
tree1b0594f3551cd2bb4d102f5642a42111ec429c5a /cdn
parentadded unittests for ping and attachments (diff)
downloadserver-d95aa0c51ad7b9d02f5a0104d6edd64982895c9a.tar.xz
added all unittests for attachments
Diffstat (limited to 'cdn')
-rw-r--r--cdn/tests/server.test.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/cdn/tests/server.test.js b/cdn/tests/server.test.js
index 6d2521a8..77d2b949 100644
--- a/cdn/tests/server.test.js
+++ b/cdn/tests/server.test.js
@@ -80,12 +80,22 @@ describe("/attachments", () => {
 					.set({ signature: Config.get().security.requestSignature })
 					.attach("file", __dirname + "/antman.jpg");
 				request.get(response.body.url.replace("http://localhost:3003", "")).then((x) => {
-					expect(x.statusCode).toBe(400);
+					expect(x.statusCode).toBe(200);
 				});
 			});
 		});
 	});
 	describe("DELETE", () => {
-		describe("without signature specified", () => {});
+		describe("deleting uploaded image by url returned by POST /attachments", () => {
+			test("route should respond with res.body.success", async () => {
+				let response = await request
+					.post("/attachments/123456789")
+					.set({ signature: Config.get().security.requestSignature })
+					.attach("file", __dirname + "/antman.jpg");
+				request.delete(response.body.url.replace("http://localhost:3003", "")).then((x) => {
+					expect(x.body.success).toBeDefined();
+				});
+			});
+		});
 	});
 });