Files
zkldi_Tachi/seeds/scripts/test/table-default.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

52 lines
1.0 KiB
TypeScript

import chalk from "chalk";
import { FormatGame, TableDocument, allGPTStrings } from "tachi-common";
import { ReadCollection } from "../util";
const gptStringMap = {};
const tables: Array<TableDocument> = ReadCollection("tables.json");
let errs = 0;
for (const t of tables) {
if (t.default && t.inactive) {
console.log(
chalk.red(
`[TABLE-DEFAULT] The default table for ${FormatGame(t.game, t.playtype)} '${
t.title
}' is inactive. This is not legal.`
)
);
errs += 1;
}
if (t.default) {
const gptString = `${t.game}:${t.playtype}`;
if (gptStringMap[gptString]) {
console.log(
chalk.red(
`[TABLE-DEFAULT] There are multiple default tables for ${FormatGame(
t.game,
t.playtype
)}. This is not legal.`
)
);
}
gptStringMap[gptString] = true;
}
}
for (const gptString of allGPTStrings) {
if (!gptStringMap[gptString]) {
console.log(chalk.red(`[TABLE-DEFAULT] There is no default table for ${gptString}.`));
errs += 1;
}
}
if (errs === 0) {
process.exit(0);
} else {
process.exit(1);
}