Skip to content

Commit

Permalink
Add test to verify maps use mapinfo.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
p2004a committed Nov 2, 2024
1 parent cbbf757 commit cbab442
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ gen/mapPresets.conf gen/mapBattlePresets.conf &: gen/map_modoptions.validated.js
ts-node scripts/js/src/gen_spads_map_presets.ts gen/mapPresets.conf gen/mapBattlePresets.conf

# Tests on data
test: typecheck_scripts check_startboxes check_startpos check_photo_aspect_ratio check_archive_not_solid
test: typecheck_scripts check_startboxes check_startpos check_photo_aspect_ratio check_archive_not_solid check_uses_mapinfo_lua
echo ok

typecheck_scripts: gen/types/map_list.d.ts gen/types/live_maps.d.ts gen/types/cdn_maps.d.ts
Expand All @@ -56,6 +56,9 @@ check_photo_aspect_ratio: gen/types/map_list.d.ts gen/map_list.validated.json
check_archive_not_solid: gen/types/map_list.d.ts gen/map_list.validated.json
ts-node scripts/js/src/check_archive_not_solid.ts

check_uses_mapinfo_lua: gen/types/map_list.d.ts gen/map_list.validated.json
ts-node scripts/js/src/check_uses_mapinfo_lua.ts

# Auxiliary build targets
types: gen/types/map_list.d.ts gen/map_list.schema.json

Expand Down
24 changes: 24 additions & 0 deletions scripts/js/src/check_uses_mapinfo_lua.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Verifies all maps use mapinfo.lua and not older methods.

import { readMapList, fetchMapsMetadata } from './maps_metadata.js';

const maps = await readMapList();
const mapsMetadata = await fetchMapsMetadata(maps);

const whitelist: Set<string> = new Set(['Mescaline_V2']);

let anyWithoutMapinfo = false;
for (const [rowyId, map] of Object.entries(maps)) {
const meta = mapsMetadata.get(rowyId);
if (!meta.mapInfo) {
if (whitelist.has(map.springName)) {
console.log(`${map.springName} doesn't use mapinfo.lua but whitelisted.`);
} else {
console.error(`ERROR: ${map.springName} doesn't use mapinfo.lua.`);
anyWithoutMapinfo = true;
}
}
}
if (anyWithoutMapinfo) {
process.exit(1);
}

0 comments on commit cbab442

Please sign in to comment.