Skip to content

Commit 8ad16e0

Browse files
VIA-629 SB & EO Add missing isActive test.
1 parent 2d05ab0 commit 8ad16e0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/utils/campaigns/types.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,13 @@ describe("Campaigns", () => {
5252

5353
expect(actual).toBe(expected);
5454
});
55+
56+
it("should return false for vaccine with no campaign", () => {
57+
const campaigns = Campaigns.fromJson(jsonString)!;
58+
59+
const active = campaigns.isActive(VaccineType.FLU_FOR_CHILDREN);
60+
61+
expect(active).toBe(false);
62+
});
5563
});
5664
});

src/utils/campaigns/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class Campaigns {
5757

5858
/** Get all campaigns for a specific vaccine */
5959
get(vaccine: VaccineType): Campaign[] {
60-
return this.schedule[vaccine] ?? [];
60+
return this.schedule[vaccine] || [];
6161
}
6262

6363
/** Check if a vaccine is currently active */

0 commit comments

Comments
 (0)