From bc8bb2eeccf307b00a66e0ad6de4096118e60b8f Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Wed, 13 Apr 2022 23:33:53 +0100 Subject: [PATCH] Always flush foldercache in tests --- server/src/lib/score-import/framework/goals/goals.test.ts | 4 ++-- server/src/lib/showcase/evaluator.test.ts | 2 +- server/src/lib/showcase/get-stats.test.ts | 2 +- server/src/lib/targets/goals.test.ts | 2 +- .../api/v1/games/_game/_playtype/folders/router.test.ts | 2 +- .../games/_game/_playtype/folders/_folderID/router.test.ts | 6 +++--- .../_userID/games/_game/_playtype/showcase/router.test.ts | 2 +- .../_userID/games/_game/_playtype/tables/router.test.ts | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/server/src/lib/score-import/framework/goals/goals.test.ts b/server/src/lib/score-import/framework/goals/goals.test.ts index fd62fa29e..7ae5074d7 100644 --- a/server/src/lib/score-import/framework/goals/goals.test.ts +++ b/server/src/lib/score-import/framework/goals/goals.test.ts @@ -65,8 +65,8 @@ t.test("#GetRelevantFolderGoals", (t) => { await db.folders.insert(sp11folder); await db.goals.insert(fakeFolderGoalDocument); await db.goals.insert(notFolderGoalDocument); - await CreateFolderChartLookup(TestingIIDXFolderSP10); - await CreateFolderChartLookup(sp11folder); + await CreateFolderChartLookup(TestingIIDXFolderSP10, true); + await CreateFolderChartLookup(sp11folder, true); }); t.test("Should correctly find the goals on this folder.", async (t) => { diff --git a/server/src/lib/showcase/evaluator.test.ts b/server/src/lib/showcase/evaluator.test.ts index fb0dba4df..315f52e65 100644 --- a/server/src/lib/showcase/evaluator.test.ts +++ b/server/src/lib/showcase/evaluator.test.ts @@ -13,7 +13,7 @@ import { IIDX_LAMPS } from "tachi-common"; t.test("#EvaluateShowcaseStat", (t) => { t.beforeEach(ResetDBState); - t.beforeEach(async () => await CreateFolderChartLookup(TestingIIDXFolderSP10)); + t.beforeEach(async () => await CreateFolderChartLookup(TestingIIDXFolderSP10, true)); t.beforeEach( async () => await db["personal-bests"].insert(deepmerge(TestingIIDXSPScorePB, {})) ); diff --git a/server/src/lib/showcase/get-stats.test.ts b/server/src/lib/showcase/get-stats.test.ts index 78a54238f..e3b49f258 100644 --- a/server/src/lib/showcase/get-stats.test.ts +++ b/server/src/lib/showcase/get-stats.test.ts @@ -14,7 +14,7 @@ t.test("#EvalulateUsersStatsShowcase", (t) => { t.beforeEach(async () => { await db.folders.insert(TestingIIDXFolderSP10); - await CreateFolderChartLookup(TestingIIDXFolderSP10); + await CreateFolderChartLookup(TestingIIDXFolderSP10, true); await db["game-settings"].remove({}); diff --git a/server/src/lib/targets/goals.test.ts b/server/src/lib/targets/goals.test.ts index 98c0e82f8..28bae6d0d 100644 --- a/server/src/lib/targets/goals.test.ts +++ b/server/src/lib/targets/goals.test.ts @@ -226,7 +226,7 @@ t.test("#EvaluateGoalForUser", (t) => { }), ]); - await CreateFolderChartLookup(TestingIIDXFolderSP10); + await CreateFolderChartLookup(TestingIIDXFolderSP10, true); }); t.test("Should work if 511 is >= HARD CLEAR", async (t) => { diff --git a/server/src/server/router/api/v1/games/_game/_playtype/folders/router.test.ts b/server/src/server/router/api/v1/games/_game/_playtype/folders/router.test.ts index 03163a7dc..a1f11efde 100644 --- a/server/src/server/router/api/v1/games/_game/_playtype/folders/router.test.ts +++ b/server/src/server/router/api/v1/games/_game/_playtype/folders/router.test.ts @@ -54,7 +54,7 @@ t.test("GET /api/v1/games/:game/:playtype/folders/:folderID", (t) => { t.test("Should return the folder at this ID.", async (t) => { await db.folders.insert(deepmerge(mockFolder, {})); - await CreateFolderChartLookup(mockFolder); + await CreateFolderChartLookup(mockFolder, true); const res = await mockApi.get("/api/v1/games/iidx/SP/folders/foo"); diff --git a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/folders/_folderID/router.test.ts b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/folders/_folderID/router.test.ts index e7557defa..be7cca9e2 100644 --- a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/folders/_folderID/router.test.ts +++ b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/folders/_folderID/router.test.ts @@ -20,7 +20,7 @@ t.test("GET /api/v1/users/:userID/games/:game/:playtype/folders/:folderID", (t) folderID: "testing_folder", }) as FolderDocument; await db.folders.insert(folder); - await CreateFolderChartLookup(folder); + await CreateFolderChartLookup(folder, true); await db["personal-bests"].insert(deepmerge(TestingIIDXSPScorePB, {})); }); @@ -56,7 +56,7 @@ t.test("GET /api/v1/users/:userID/games/:game/:playtype/folders/:folderID/timeli t.beforeEach(ResetDBState); t.beforeEach(async () => { await db.folders.insert(folder); - await CreateFolderChartLookup(folder); + await CreateFolderChartLookup(folder, true); await db["personal-bests"].insert(deepmerge(TestingIIDXSPScorePB, {})); }); @@ -68,7 +68,7 @@ t.test("GET /api/v1/users/:userID/games/:game/:playtype/folders/:folderID/timeli await db.songs.iidx.insert(GetKTDataJSON("./tachi/tachi-songs-iidx.json")); await db.charts.iidx.insert(GetKTDataJSON("./tachi/tachi-charts-iidx.json")); - await CreateFolderChartLookup(folder); + await CreateFolderChartLookup(folder, true); await db.scores.insert([ deepmerge(TestingIIDXSPScore, { diff --git a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/showcase/router.test.ts b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/showcase/router.test.ts index f3ec80f82..ba385673c 100644 --- a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/showcase/router.test.ts +++ b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/showcase/router.test.ts @@ -9,7 +9,7 @@ import { CreateFolderChartLookup } from "utils/folder"; const SetFolders = async () => { await db.folders.insert(TestingIIDXFolderSP10); - await CreateFolderChartLookup(TestingIIDXFolderSP10); + await CreateFolderChartLookup(TestingIIDXFolderSP10, true); await db["game-settings"].remove({}); diff --git a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/tables/router.test.ts b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/tables/router.test.ts index 5263e6d23..77b01499a 100644 --- a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/tables/router.test.ts +++ b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/tables/router.test.ts @@ -16,7 +16,7 @@ t.test("GET /api/v1/users/:userID/games/:game/:playtype/tables/:tableID", (t) => }) as FolderDocument; await db.folders.insert(folder); - await CreateFolderChartLookup(folder); + await CreateFolderChartLookup(folder, true); await db["personal-bests"].insert(TestingIIDXSPScorePB);