Skip to content

Commit

Permalink
tests: added verify check for wrong/unknown set names
Browse files Browse the repository at this point in the history
  • Loading branch information
JayDi85 committed Jan 25, 2025
1 parent 49b0568 commit 92a6f39
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@
import mage.cards.decks.importer.DeckImporter;
import mage.cards.repository.*;
import mage.choices.Choice;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.*;
import mage.filter.Filter;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates;
Expand Down Expand Up @@ -968,21 +965,26 @@ public void test_checkMissingSetData() {

// CHECK: wrong set name
for (ExpansionSet set : sets) {
if (true) {
continue; // TODO: enable after merge of 40k's cards pull requests (needs before set rename)
if (set.getSetType().equals(SetType.CUSTOM_SET)) {
// skip unofficial sets like Star Wars
continue;
}

MtgJsonSet jsonSet = MtgJsonService.sets().getOrDefault(set.getCode().toUpperCase(Locale.ENGLISH), null);
if (jsonSet == null) {
// unofficial or inner set
continue;
}
if (!Objects.equals(set.getName(), jsonSet.name)) {
// how-to fix: rename xmage set to the json version or fix a set's code
// also don't forget to change names in mtg-cards-data.txt
errorsList.add(String.format("Error: wrong set name or set code: %s (mtgjson set for same code: %s)",
set.getCode() + " - " + set.getName(),
jsonSet.name
errorsList.add(String.format("Error: unknown official set: %s - %s (make sure it use correct set code or mark it as SetType.CUSTOM_SET)",
set.getCode(),
set.getName()
));
} else {
if (!Objects.equals(set.getName(), jsonSet.name)) {
// how-to fix: rename xmage set to the json version or fix a set's code
// also don't forget to change names in mtg-cards-data.txt
errorsList.add(String.format("Error: wrong set name or set code: %s (mtgjson set for same code: %s)",
set.getCode() + " - " + set.getName(),
jsonSet.name
));
}
}
}

Expand Down

0 comments on commit 92a6f39

Please sign in to comment.