From aedebb146168ab8a5c1e69d6553f21ed28200279 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 7 Mar 2026 21:01:23 +0800 Subject: [PATCH] fix test case failures when the original Chinese calendar data uses CRLF line endings --- src/lib/calendar/__tests__/chinese_calendar.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/calendar/__tests__/chinese_calendar.ts b/src/lib/calendar/__tests__/chinese_calendar.ts index d74d1cc7..6aa12fb9 100644 --- a/src/lib/calendar/__tests__/chinese_calendar.ts +++ b/src/lib/calendar/__tests__/chinese_calendar.ts @@ -48,7 +48,7 @@ const localeData: ChineseCalendarLocaleData = { const ordinalSuffix = ['st', 'nd', 'rd']; describe('getChineseYearMonthAllDayInfos', () => { - const lines: string[] = fs.readFileSync(path.join(__dirname, 'chinese_calendar_all_data.txt'), 'utf8').split('\n'); + const lines: string[] = fs.readFileSync(path.join(__dirname, 'chinese_calendar_all_data.txt'), 'utf8').replace(/\r/g, '').split('\n'); const allMonthChineseDays: Record = {}; const allMonthSolarTermNames: Record = {}; let currentMonthChineseDays: string[] = []; @@ -121,7 +121,7 @@ describe('getChineseYearMonthAllDayInfos', () => { }); describe('getChineseYearMonthDayInfo', () => { - const lines: string[] = fs.readFileSync(path.join(__dirname, 'chinese_calendar_all_data.txt'), 'utf8').split('\n'); + const lines: string[] = fs.readFileSync(path.join(__dirname, 'chinese_calendar_all_data.txt'), 'utf8').replace(/\r/g, '').split('\n'); for (const line of lines) { if (!line.trim() || line.startsWith('#')) {