From 8750607d3d7321f625856c140f839a3e94beaf54 Mon Sep 17 00:00:00 2001 From: Jason Gessner Date: Fri, 13 Dec 2024 23:37:31 -0600 Subject: [PATCH] Add a test to ensure that all restrictions are also in a snapshot. --- test/validate_v2.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/validate_v2.ts b/test/validate_v2.ts index a6766c7c..1683f81c 100644 --- a/test/validate_v2.ts +++ b/test/validate_v2.ts @@ -473,6 +473,31 @@ describe('Restrictions', () => { } }); }); + + it('are present in format files', () => { + let restrictionIdsFromFormats = new Set(); + + // Get all formats and their listed snapshots. + formatsByFilename.forEach((format, file) => { + format.snapshots.forEach(snapshot => { + if ('restriction_id' in snapshot) { + restrictionIdsFromFormats.add(snapshot.restriction_id); + } + }); + }); + + // Put any startup banlists for NRDB Classic in here. + const ignoreRestrictions = new Set( + ['startup_ban_list_24_01_for_classic_only', 'startup_ban_list_24_09_for_classic_only']); + + restrictionIds.forEach((restrictionId) => { + if (ignoreRestrictions.has(restrictionId)) { + return; + } + + expect(restrictionIdsFromFormats, `Restriction ${restrictionId} is not specified in any format snapshots.`).to.include(restrictionId); + }); + }); }); describe('Formats', () => {