remove empty rows from userNames

This commit is contained in:
Michael C
2021-12-18 21:32:13 -05:00
parent caf94a7a93
commit 544af7ce15
2 changed files with 13 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ const user06PrivateUserID = "setUsername_06";
const username06 = "Username 06";
const user07PrivateUserID = "setUsername_07";
const username07 = "Username 07";
const user08PrivateUserID = "setUsername_08";
async function addUsername(userID: string, userName: string, locked = 0) {
await db.prepare("run", 'INSERT INTO "userNames" ("userID", "userName", "locked") VALUES(?, ?, ?)', [userID, userName, locked]);
@@ -231,4 +232,14 @@ describe("setUsername", () => {
})
.catch((err) => done(err));
});
it("Should delete row if new username is same as publicID", (done) => {
const publicID = getHash(user08PrivateUserID);
postSetUserName(getHash(user08PrivateUserID), publicID)
.then(async () => {
const usernameInfo = await getUsernameInfo(getHash(user08PrivateUserID));
assert.strictEqual(usernameInfo, null);
done();
});
});
});