more updated tests
This commit is contained in:
parent
35bcc5c5b9
commit
bbc92dc01c
@ -87,8 +87,24 @@ describe("GET /api/note", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("POST /api/note", () => {
|
describe("POST /api/note", () => {
|
||||||
it("returns a view_url on correct POST body (without plugin version and user id)", async () => {
|
it("returns a view_url on correct POST body with embeds", async () => {
|
||||||
const res = await supertest(app).post("/api/note").send(testNote);
|
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);
|
expectCodeOrThrowResponse(res, 200);
|
||||||
|
|
||||||
|
@ -96,7 +96,6 @@ export async function postNoteController(
|
|||||||
|
|
||||||
// Validate user ID, if present
|
// Validate user ID, if present
|
||||||
if (notePostRequest.user_id && !checkId(notePostRequest.user_id)) {
|
if (notePostRequest.user_id && !checkId(notePostRequest.user_id)) {
|
||||||
console.log("invalid user id");
|
|
||||||
res.status(400).send("Invalid user id (checksum failed)");
|
res.status(400).send("Invalid user id (checksum failed)");
|
||||||
event.error = "Invalid user id (checksum failed)";
|
event.error = "Invalid user id (checksum failed)";
|
||||||
EventLogger.writeEvent(event);
|
EventLogger.writeEvent(event);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user