Fix broken tests

This commit is contained in:
zkldi
2021-10-13 00:50:26 +01:00
parent b9d37ff07c
commit 0c12fb18e5
2 changed files with 15 additions and 5 deletions
@@ -122,7 +122,7 @@ t.test("#ReprocessOrphan", (t) => {
t.test("Should convert and insert an orphan if parents are found", async (t) => {
// this orphan doc is for 5.1.1. SPA, which definitely exists in
// the test DB.
const res = await ReprocessOrphan(orphanDoc, logger);
const res = await ReprocessOrphan(orphanDoc, [], logger);
t.hasStrict(
res,
@@ -171,6 +171,7 @@ t.test("#ReprocessOrphan", (t) => {
score: 99999,
},
}),
[],
logger
);
@@ -193,6 +194,7 @@ t.test("#ReprocessOrphan", (t) => {
identifier: "NONSENSE CHART TITLE",
},
}),
[],
logger
);
@@ -227,6 +229,7 @@ t.test("#ReprocessOrphan", (t) => {
identifier: GAZER_SHA256,
},
}),
[],
logger
);
@@ -66,21 +66,28 @@ t.test("POST /api/v1/admin/change-log-level", async (t) => {
t.test("POST /api/v1/admin/delete-score", async (t) => {
t.beforeEach(ResetDBState);
const auth = await CreateFakeAuthCookie(mockApi);
await db.scores.insert(
deepmerge<ScoreDocument>(TestingIIDXSPScore, {
scoreID: "deleteme",
})
);
const res = await mockApi.post("/api/v1/admin/delete-score").send({
scoreID: "deleteme",
});
const res = await mockApi
.post("/api/v1/admin/delete-score")
.set({
Cookie: auth,
})
.send({
scoreID: "deleteme",
});
t.equal(res.statusCode, 200);
const dbScore = await db.scores.findOne({ scoreID: "deleteme" });
t.equal(dbScore, null, "Should remove teh score from the database.");
t.equal(dbScore, null, "Should remove the score from the database.");
t.end();
});