From 770fa2bc48a82eb33ac3726cd507ff066ba33243 Mon Sep 17 00:00:00 2001 From: "Michael J. Radwin" Date: Sun, 12 Jan 2025 11:50:41 -0800 Subject: [PATCH] Make DailyLearning.has also be case-insensitive --- package.json | 2 +- src/DailyLearning.ts | 2 +- test/DailyLearning.spec.ts | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 339a292..fe94571 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hebcal/core", - "version": "5.8.12", + "version": "5.8.13", "author": "Michael J. Radwin (https://github.com/mjradwin)", "contributors": [ "Eyal Schachter (https://github.com/Scimonster)", diff --git a/src/DailyLearning.ts b/src/DailyLearning.ts index 02dfb3f..2d69365 100644 --- a/src/DailyLearning.ts +++ b/src/DailyLearning.ts @@ -41,7 +41,7 @@ export class DailyLearning { * @param name case insensitive */ static has(name: string): boolean { - return cals.has(name); + return cals.has(name.toLowerCase()); } /** Returns the names of all calendars registered */ diff --git a/test/DailyLearning.spec.ts b/test/DailyLearning.spec.ts index f8a638c..11cba3f 100644 --- a/test/DailyLearning.spec.ts +++ b/test/DailyLearning.spec.ts @@ -6,7 +6,10 @@ test('DailyLearning', () => { expect(DailyLearning.getCalendars()).toEqual([]); const dummy = () => {return null}; const hd = new HDate(); + expect(DailyLearning.has('Foo')).toBe(false); DailyLearning.addCalendar('Foo', dummy); + expect(DailyLearning.has('Foo')).toBe(true); + expect(DailyLearning.has('foo')).toBe(true); DailyLearning.addCalendar('Bar', dummy); expect(DailyLearning.getCalendars()).toEqual(['foo', 'bar']); const dummy2 = () => {return {bogus: true}};