re-enable warning if still within issue time

This commit is contained in:
Michael C
2021-07-28 02:51:09 -04:00
parent d4e45cc3b0
commit 32056ab2f1
2 changed files with 47 additions and 1 deletions

View File

@@ -112,4 +112,27 @@ describe("postWarning", () => {
})
.catch(err => done(err));
});
it("Should re-enable disabled warning", (done: Done) => {
const json = {
issuerUserID: "warning-vip",
userID: "warning-0",
enabled: true
};
fetch(`${getbaseURL()}/api/warnUser`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(json),
})
.then(async res => {
assert.strictEqual(res.status, 200);
const data = await db.prepare("get", `SELECT "userID", "issueTime", "issuerUserID", enabled FROM warnings WHERE "userID" = ?`, [json.userID]);
assert.strictEqual(data.enabled, 1);
done();
})
.catch(err => done(err));
});
});