mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-14 07:27:01 +03:00
remove empty rows from userNames
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user