Make tests honor unique usernamelowercase index

This commit is contained in:
zkldi
2021-09-02 16:34:15 +01:00
parent 2f60ae20c4
commit 62f62bd24c
5 changed files with 6 additions and 0 deletions
@@ -54,6 +54,7 @@ t.test("GET /api/v1/games/:game/:playtype/charts/:chartID/pbs", (t) => {
await db.users.insert({
id: 2,
username: "foo",
usernameLowercase: "foo",
} as PrivateUserDocument);
const res = await mockApi.get(`/api/v1/games/iidx/SP/charts/${Testing511SPA.chartID}/pbs`);
@@ -95,6 +95,7 @@ t.test("GET /api/v1/users/:userID/games/:game/:playtype/showcase", (t) => {
// hack
await db.users.insert({
username: "test_acc",
usernameLowercase: "test_acc",
id: 2,
} as PrivateUserDocument);
@@ -39,6 +39,7 @@ t.test("GET /api/v1/users", (t) => {
t.equal(res.body.body.length, 0);
await db.users.insert({
username: "online_dude",
usernameLowercase: "online_dude",
lastSeen: Date.now(),
id: 2,
@@ -54,6 +55,7 @@ t.test("GET /api/v1/users", (t) => {
t.test("Should return users sorted by lastSeen if no arguments are passed.", async (t) => {
await db.users.insert({
username: "online_dude",
usernameLowercase: "online_dude",
lastSeen: Date.now(),
id: 2,
@@ -266,6 +266,7 @@ t.test("GET /charts/:chartHash/leaderboard", (t) => {
await db.users.insert({
id: 2,
username: "not_zkldi",
usernameLowercase: "not_zkldi",
} as PrivateUserDocument);
await db.scores.insert([
@@ -234,6 +234,7 @@ const uscScorePBsSet = [
const mockUserDocs = [2, 3, 4, 5, 6, 7, 8, 9, 10].map((e) => ({
id: e,
username: e.toString(),
usernameLowercase: e.toString(),
})) as PrivateUserDocument[];
t.test("#CreatePOSTScoresResponseBody", async (t) => {