fix: unbreak tests as a result of the rivals addition

This commit is contained in:
zkldi
2022-04-21 05:29:56 +01:00
parent 282139861c
commit 07f950beae
4 changed files with 20 additions and 2 deletions
@@ -46,6 +46,7 @@ t.test("#EvalulateUsersStatsShowcase", (t) => {
bpiTarget: 0,
},
},
rivals: [],
});
await db["personal-bests"].insert(deepmerge(TestingIIDXSPScorePB, {}));
@@ -1,9 +1,10 @@
import t from "tap";
import mockApi from "test-utils/mock-api";
import { GetGamePTConfig, UserGameStats } from "tachi-common";
import { GetGamePTConfig, PublicUserDocument, UserGameStats } from "tachi-common";
import dm from "deepmerge";
import ResetDBState from "test-utils/resets";
import db from "external/mongo/db";
import { FakeOtherUser } from "test-utils/test-data";
t.test("GET /api/v1/games/:game/:playtype", (t) => {
t.test("Should return information about the game:playtype.", async (t) => {
@@ -86,6 +87,15 @@ t.test("GET /api/v1/games/:game/:playtype/leaderboard", (t) => {
},
] as UserGameStats[]);
await db.users.insert([
FakeOtherUser,
dm(FakeOtherUser, {
username: "foo",
usernameLowercase: "foo",
id: 3,
}) as PublicUserDocument,
]);
const res = await mockApi.get("/api/v1/games/iidx/SP/leaderboard?alg=BPI");
t.strictSame(
@@ -27,6 +27,7 @@ t.test("GET /api/v1/users/:userID/games/:game/:playtype/settings", (t) => {
bpiTarget: 0,
},
},
rivals: [],
});
t.end();
@@ -74,6 +75,7 @@ t.test("PATCH /api/v1/users/:userID/games/:game/:playtype/settings", (t) => {
bpiTarget: 0,
},
},
rivals: [],
},
"Should only update the mutated properties."
);
@@ -129,6 +131,7 @@ t.test("PATCH /api/v1/users/:userID/games/:game/:playtype/settings", (t) => {
bpiTarget: 50,
},
},
rivals: [],
},
"Should only update the mutated properties."
);
@@ -188,6 +191,7 @@ t.test("PATCH /api/v1/users/:userID/games/:game/:playtype/settings", (t) => {
bpiTarget: target,
},
},
rivals: [],
},
"Should only update the mutated properties."
);
@@ -419,6 +423,7 @@ t.test("PATCH /api/v1/users/:userID/games/:game/:playtype/settings", (t) => {
bpiTarget: 0,
},
},
rivals: [],
},
"Should only update the mutated properties."
);
@@ -41,6 +41,7 @@ const SetFolders = async () => {
bpiTarget: 0,
},
},
rivals: [],
});
await db["personal-bests"].insert(deepmerge(TestingIIDXSPScorePB, {}));
@@ -100,6 +101,7 @@ t.test("GET /api/v1/users/:userID/games/:game/:playtype/showcase", (t) => {
bpiTarget: 0,
},
},
rivals: [],
});
// hack