Add unit test for having valid formats

This commit is contained in:
Guangcong Luo
2021-04-09 18:04:40 -07:00
parent b4da54c6da
commit 5cf59da9f0

View File

@@ -138,11 +138,17 @@ describe('Dex data', function () {
}
});
it('should have valid Formats entries', function () {
const Formats = Dex.data.Rulesets;
for (const formatid in Formats) {
const entry = Formats[formatid];
assert.equal(toID(entry.name), formatid, `Mismatched Format/Ruleset key "${formatid}" of "${entry.name}"`);
it('should have valid Rulesets entries', function () {
const Rulesets = Dex.data.Rulesets;
for (const formatid in Rulesets) {
const entry = Rulesets[formatid];
assert.equal(toID(entry.name), formatid, `Mismatched Ruleset key "${formatid}" of "${entry.name}"`);
}
});
it('should have valid Formats', function () {
for (const format of Dex.formats.all()) {
Dex.formats.getRuleTable(format);
}
});