Skip to content

Commit e0578fb

Browse files
fix: update ruleMapping tests to allow undefined reportingId for system exceptions
1 parent ec63b77 commit e0578fb

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

application/CohortManager/src/Web/app/lib/ruleMapping.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe("ruleMapping", () => {
2020
expect(mapping).toHaveProperty("reportingId");
2121
expect(typeof mapping.ruleDescription).toBe("string");
2222
expect(mapping.ruleDescription.length).toBeGreaterThan(0);
23-
expect(typeof mapping.reportingId).toBe("string");
23+
expect(["string", "undefined"]).toContain(typeof mapping.reportingId);
2424
if (mapping.reportingId) {
2525
expect(mapping.reportingId.length).toBeGreaterThan(0);
2626
}
@@ -143,9 +143,11 @@ describe("ruleMapping", () => {
143143

144144
describe("specific rule validations", () => {
145145
it("should have correct CMR reporting IDs format", () => {
146-
Object.values(ruleIdMappings).forEach((mapping) => {
147-
expect(mapping.reportingId).toMatch(/^CMR\d+$/);
148-
});
146+
Object.values(ruleIdMappings)
147+
.filter((mapping) => mapping.reportingId !== undefined)
148+
.forEach((mapping) => {
149+
expect(mapping.reportingId).toMatch(/^CMR\d+$/);
150+
});
149151
});
150152

151153
it("should have non-empty rule descriptions", () => {

0 commit comments

Comments
 (0)