Skip to content

Commit

Permalink
Add a test to ensure that all restrictions are also in a snapshot.
Browse files Browse the repository at this point in the history
  • Loading branch information
plural committed Dec 14, 2024
1 parent 83575ee commit 8750607
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', () => {
let restrictionIdsFromFormats = new Set<string>();

Check failure on line 478 in test/validate_v2.ts

View workflow job for this annotation

GitHub Actions / format_and_lint_and_test

'restrictionIdsFromFormats' is never reassigned. Use 'const' instead

// Get all formats and their listed snapshots.
formatsByFilename.forEach((format, file) => {

Check warning on line 481 in test/validate_v2.ts

View workflow job for this annotation

GitHub Actions / format_and_lint_and_test

'file' is defined but never used
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 8750607

Please sign in to comment.