Files
zkldi_Tachi/seeds/scripts/test/goal-id.test.ts
T
zk 593adb2717 feat: Dev Container (#1149)
* temporary dvctr

* start of work

* fix: timeouts in windows

* fish?

* feat: better, working stuff

* refactor: rename database-seeds to seeds/

* better

* fdsaf

* feat: don't let our container get owned by root

* fix: better user handling

* feat: falling asleep at my desk i yield to you what i have done

* feat: autoadminify

* docs: denote trickshot

* feat: open in browser on launch

* better seeds workings...

* fix: dont kill shell

* docs: mention dev/debs

* fix: whoops

* fix: make seeds load within the century

* feat: rest of the containerisation

* feat: new alias

* style: fix linter errors

* fix: bad call

* fix: better justfile
2024-08-17 15:01:40 +01:00

38 lines
924 B
TypeScript

import chalk from "chalk";
import { GoalDocument } from "tachi-common";
import { CreateGoalID, ReadCollection } from "../util";
import { FormatFunctions } from "./test-utils";
let success = 0;
let fails = 0;
const goals = ReadCollection("goals.json", true) as GoalDocument[];
for (const goal of goals) {
const pretty = FormatFunctions.goals!(goal, null);
const expectedGoalID = CreateGoalID(goal.charts, goal.criteria, goal.game, goal.playtype);
if (expectedGoalID !== goal.goalID) {
console.error(
chalk.red(
`[ERR] | ${pretty} | Expected goalID to be ${expectedGoalID}. Got ${goal.goalID}.`
)
);
fails++;
} else {
success++;
}
}
console.log(chalk[fails === 0 ? "green" : "red"](`[GOAL_ID]: ${success} good, ${fails} bad.`));
if (fails !== 0) {
console.log(
chalk.yellow("Run scripts/rerunners/fix-goal-ids.js to automatically fix these issues.")
);
}
process.exit(fails !== 0 ? 1 : 0);