From d95aa0c51ad7b9d02f5a0104d6edd64982895c9a Mon Sep 17 00:00:00 2001 From: xnacly Date: Wed, 18 Aug 2021 19:29:16 +0200 Subject: [PATCH] added all unittests for attachments --- cdn/tests/server.test.js | 14 ++++++++++++-- 1 file 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(); + }); + }); + }); }); });