From 603bad49676a8ad219244b08d8b6099973d0947c Mon Sep 17 00:00:00 2001 From: Ajay Date: Thu, 21 Jul 2022 14:19:41 -0400 Subject: [PATCH] Add another warning test --- src/routes/postWarning.ts | 2 +- test/cases/postWarning.ts | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/routes/postWarning.ts b/src/routes/postWarning.ts index f003570..f9eaa4c 100644 --- a/src/routes/postWarning.ts +++ b/src/routes/postWarning.ts @@ -30,7 +30,7 @@ export async function postWarning(req: Request, res: Response): Promise { }) .catch(err => done(err)); }); + + it("Should be able to add your own warning", (done) => { + const json = { + userID: "warning-0" + }; + + client.post(endpoint, json) + .then(async res => { + assert.strictEqual(res.status, 403); + const data = await getWarning(warnedUser); + const expected = { + enabled: 0 + }; + assert.ok(partialDeepEquals(data, expected)); + done(); + }) + .catch(err => done(err)); + }); });