1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-10 12:42:44 +01:00

added all unittests for attachments

This commit is contained in:
xnacly 2021-08-18 19:29:16 +02:00
parent fd03d9aab5
commit d95aa0c51a

View File

@ -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();
});
});
});
});
});