From bbc92dc01cb1d97701206b3477521ba16fbaefb3 Mon Sep 17 00:00:00 2001 From: Maxime Cannoodt Date: Tue, 30 Aug 2022 13:29:00 +0200 Subject: [PATCH] more updated tests --- server/src/app.integration.test.ts | 20 +++++++++++++++++-- .../controllers/note/note.post.controller.ts | 1 - 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/server/src/app.integration.test.ts b/server/src/app.integration.test.ts index 734c104..9fb4c9d 100644 --- a/server/src/app.integration.test.ts +++ b/server/src/app.integration.test.ts @@ -87,8 +87,24 @@ describe("GET /api/note", () => { }); describe("POST /api/note", () => { - it("returns a view_url on correct POST body (without plugin version and user id)", async () => { - const res = await supertest(app).post("/api/note").send(testNote); + it("returns a view_url on correct POST body with embeds", async () => { + const res = await supertest(app) + .post("/api/note") + .send({ + ...testNote, + embeds: [ + { + embed_id: "sample_embed_id0", + ciphertext: Buffer.from("sample_ciphertext").toString("base64"), + hmac: Buffer.from("sample_hmac").toString("base64"), + }, + { + embed_id: "sample_embed_id1", + ciphertext: Buffer.from("sample_ciphertext").toString("base64"), + hmac: Buffer.from("sample_hmac").toString("base64"), + }, + ], + }); expectCodeOrThrowResponse(res, 200); diff --git a/server/src/controllers/note/note.post.controller.ts b/server/src/controllers/note/note.post.controller.ts index c554037..83f66fe 100644 --- a/server/src/controllers/note/note.post.controller.ts +++ b/server/src/controllers/note/note.post.controller.ts @@ -96,7 +96,6 @@ export async function postNoteController( // Validate user ID, if present if (notePostRequest.user_id && !checkId(notePostRequest.user_id)) { - console.log("invalid user id"); res.status(400).send("Invalid user id (checksum failed)"); event.error = "Invalid user id (checksum failed)"; EventLogger.writeEvent(event);