diff --git a/backend/tests/utils/test_platforms.py b/backend/tests/utils/test_platforms.py index ee7eccba6..f14af9d13 100644 --- a/backend/tests/utils/test_platforms.py +++ b/backend/tests/utils/test_platforms.py @@ -23,3 +23,18 @@ def test_supported_platform_not_shadowed_by_variant(): assert arcade.name == "Arcade" assert arcade.fs_slug == "arcade" + + +def test_supported_platform_keeps_tgdb_id_from_tgdb(): + """The TGDB platform ID must survive the metadata merge. + + Regression for the tgdb_id fallback chain missing the TGDB handler + itself: MobyGames platforms never carry a tgdb_id and the Hasheous + platform list has no TGDB mappings, so every unmatched platform was + reported with tgdb_id=None even when TGDB knows the platform. + """ + supported = get_supported_platforms() + threedo = next(p for p in supported if p.slug == "3do") + + # TGDB maps the 3DO platform to ID 25. + assert threedo.tgdb_id == 25 diff --git a/backend/utils/platforms.py b/backend/utils/platforms.py index 42b338f43..104438bfd 100644 --- a/backend/utils/platforms.py +++ b/backend/utils/platforms.py @@ -90,6 +90,7 @@ def get_supported_platforms() -> list[PlatformSchema]: or None, "tgdb_id": moby_platform.get("tgdb_id") or hasheous_platform.get("tgdb_id") + or tgdb_platform.get("tgdb_id") or None, "name": igdb_platform.get("name") or ss_platform.get("name")