From 0c12fb18e58aefd7fdd618fa4dfcbc55f07fc841 Mon Sep 17 00:00:00 2001 From: zkldi Date: Wed, 13 Oct 2021 00:50:26 +0100 Subject: [PATCH] Fix broken tests --- .../framework/orphans/orphans.test.ts | 5 ++++- .../src/server/router/api/v1/admin/router.test.ts | 15 +++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/server/src/lib/score-import/framework/orphans/orphans.test.ts b/server/src/lib/score-import/framework/orphans/orphans.test.ts index ceb8af40d..932436ea4 100644 --- a/server/src/lib/score-import/framework/orphans/orphans.test.ts +++ b/server/src/lib/score-import/framework/orphans/orphans.test.ts @@ -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 ); diff --git a/server/src/server/router/api/v1/admin/router.test.ts b/server/src/server/router/api/v1/admin/router.test.ts index 5ece3f9f4..3665cba88 100644 --- a/server/src/server/router/api/v1/admin/router.test.ts +++ b/server/src/server/router/api/v1/admin/router.test.ts @@ -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(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(); });