diff --git a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/targets/goals/router.test.ts b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/targets/goals/router.test.ts index f716cd6b7..24ed1aab7 100644 --- a/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/targets/goals/router.test.ts +++ b/server/src/server/router/api/v1/users/_userID/games/_game/_playtype/targets/goals/router.test.ts @@ -14,6 +14,7 @@ import { TestingIIDXFolderSP10, TestingIIDXSPMilestone, } from "test-utils/test-data"; +import { CreateFolderChartLookup } from "utils/folder"; // @ts-expect-error Not sure why the types break here, but they do. const dupedGoal = dm({}, HC511Goal); @@ -86,6 +87,8 @@ t.test("POST /api/v1/users/:userID/games/:game/:playtype/targets/add-goal", asyn // @ts-expect-error weird type issues t.beforeEach(() => db.folders.insert(dm(TestingIIDXFolderSP10, {}))); + t.beforeEach(() => CreateFolderChartLookup(TestingIIDXFolderSP10, true)); + const multiCharts = { type: "multi", data: [Testing511SPA.chartID, "another_chart"], @@ -416,7 +419,7 @@ t.test("POST /api/v1/users/:userID/games/:game/:playtype/targets/add-goal", asyn }), mkInput("too big score", { criteria: { - key: "scoreData.gradeIndex", + key: "scoreData.score", value: 9_000, }, }), diff --git a/server/src/test-utils/mock-db/folder-chart-lookup.json b/server/src/test-utils/mock-db/folder-chart-lookup.json index 0637a088a..85f1a6ea3 100644 --- a/server/src/test-utils/mock-db/folder-chart-lookup.json +++ b/server/src/test-utils/mock-db/folder-chart-lookup.json @@ -1 +1,6 @@ -[] \ No newline at end of file +[ + { + "chartID": "c2311194e3897ddb5745b1760d2c0141f933e683", + "folderID": "ed9d8c734447ce67d7135c0067441a98cc81aeaf" + } +] \ No newline at end of file diff --git a/server/src/test-utils/snapshots/snapshot-data.json b/server/src/test-utils/snapshots/snapshot-data.json index ba173504b..f9be219bf 100644 --- a/server/src/test-utils/snapshots/snapshot-data.json +++ b/server/src/test-utils/snapshots/snapshot-data.json @@ -5,8 +5,8 @@ "Invalid Goal: abs without countNum": "[criteria.countNum] Expected number to be greater than or equal to 0. (Received nothing)", "Invalid Goal: proportion without countNum": "[criteria.countNum] Expected number to be greater than or equal to 0. (Received nothing)", "Invalid Goal: single with countNum": "[criteria.countNum] Invalid countNum for mode 'single'. Must not have one! (Received 123)", - "Invalid Goal: nonsense mode": "[criteria.mode] Expected any of single, abs, proportion. (Received nonsense)", - "Invalid Goal: abs with countNum but charts.type == single": "Invalid countNum for goal with criteria.mode of 'abs'. Expected a whole number less than the total amount of charts available and greater than 1.", + "Invalid Goal: nonsense mode": "[criteria.mode] Expected any of single, absolute, proportion. (Received nonsense)", + "Invalid Goal: abs with countNum but charts.type == single": "Invalid countNum for goal with criteria.mode of 'absolute'. Expected a whole number less than the total amount of charts available and greater than 1. (Got 1, while total charts was 1.)", "Invalid Goal: nonsense charts.type": "[charts.type] Expected any of single, multi, folder, any. (Received nonsense)", "Invalid Goal: charts.data when type == any": "[charts.data] Invalid charts.data for type 'any'. Must not have any data! (Received foo)", "Invalid Goal: charts.data array when type == single": "[charts.data] Expected a string in charts.data due to charts.type being 'single'. (Received c2311194e3897ddb5745b1760d2c0141f933e683,another_chart)", @@ -20,12 +20,12 @@ "Invalid Goal: invalid grade": "Invalid value of 0.5 for grade goal. No such grade exists at that index.", "Invalid Goal: too big lamp": "Invalid value of 8 for lamp goal. No such lamp exists at that index.", "Invalid Goal: invalid lamp": "Invalid value of 0.5 for lamp goal. No such lamp exists at that index.", - "Invalid Goal: too big score": "Invalid value of 9000 for grade goal. No such grade exists at that index.", "Invalid Goal: proportion with negative countNum": "[criteria.countNum] Expected number to be greater than or equal to 0. (Received -0.5)", "Invalid Goal: proportion with greater than 1 countNum": "Invalid countNum for goal with criteria.mode of 'proportion'. Expected a decimal in (0, 1]", - "Invalid Goal: proportion which results in countNum of 0": "countNum is too small for goal. Would result in requiring 0 charts to achieve the goal.", + "Invalid Goal: proportion which results in countNum of 0": "countNum (0.05) is too small for a goal with 2 charts. Would result in requiring 0 charts to achieve the goal.", "Invalid Goal: charts.data array of chartIDs where some don't exist": "Expected charts.data to match 2 charts. Instead, it only matched 1. Are all of these chartIDs valid?", "Invalid Goal: folder-score for iidx is illegal": "Invalid key for iidx with multiple charts. Creating score goals on multiple charts where score is relative to notecount is a terrible idea, and has been disabled.", "Invalid Goal: any-score for iidx is illegal": "Invalid key for iidx with multiple charts. Creating score goals on multiple charts where score is relative to notecount is a terrible idea, and has been disabled.", - "Invalid Goal: charts single but criteria not.": "Invalid countNum for goal with criteria.mode of 'abs'. Expected a whole number less than the total amount of charts available and greater than 1." + "Invalid Goal: charts single but criteria not.": "Invalid countNum for goal with criteria.mode of 'absolute'. Expected a whole number less than the total amount of charts available and greater than 1. (Got 2, while total charts was 1.)", + "Invalid Goal: too big score": "Invalid value of 9000 for goal. Maximum score possible on this chart is 1572." } \ No newline at end of file