Limit username creation

This commit is contained in:
mini-bomba
2025-04-29 00:02:19 +02:00
parent 339ba127eb
commit 655789e62d
4 changed files with 72 additions and 11 deletions

View File

@@ -1,6 +1,9 @@
import { getHash } from "../../src/utils/getHash";
import { client } from "../utils/httpClient";
import assert from "assert";
import { insertSegment } from "../utils/segmentQueryGen";
import { db } from "../../src/databases/databases";
import { HashedUserID } from "../../src/types/user.model";
// helpers
const getUsername = (userID: string) => client({
@@ -22,6 +25,10 @@ const userOnePublic = getHash(userOnePrivate);
const userOneUsername = "getUsername_username";
describe("getUsername test", function() {
before(async () => {
await insertSegment(db, { userID: userOnePublic as HashedUserID });
});
it("Should get back publicUserID if not set", (done) => {
getUsername(userOnePrivate)
.then(result => {
@@ -50,4 +57,4 @@ describe("getUsername test", function() {
})
.catch(err => done(err));
});
});
});