fix test case failures when the original Chinese calendar data uses CRLF line endings

This commit is contained in:
MaysWind
2026-03-07 21:01:23 +08:00
parent 1336377598
commit aedebb1461
@@ -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<string, string[]> = {};
const allMonthSolarTermNames: Record<string, string[]> = {};
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('#')) {