Skip to content

Commit

Permalink
Merge pull request #860 from plural/banlist-format-test
Browse files Browse the repository at this point in the history
Add a test to ensure that all restrictions are also in a snapshot.
  • Loading branch information
plural authored Dec 14, 2024
2 parents 83575ee + bcddbcb commit 9c74a3b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/validate_v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,31 @@ describe('Restrictions', () => {
}
});
});

it('are present in format files', () => {
const restrictionIdsFromFormats = new Set<string>();

// Get all formats and their listed snapshots.
formatsByFilename.forEach((format) => {
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<string>(
['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', () => {
Expand Down

0 comments on commit 9c74a3b

Please sign in to comment.