fix test case failures when the original Chinese calendar data uses CRLF line endings
This commit is contained in:
@@ -48,7 +48,7 @@ const localeData: ChineseCalendarLocaleData = {
|
|||||||
const ordinalSuffix = ['st', 'nd', 'rd'];
|
const ordinalSuffix = ['st', 'nd', 'rd'];
|
||||||
|
|
||||||
describe('getChineseYearMonthAllDayInfos', () => {
|
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 allMonthChineseDays: Record<string, string[]> = {};
|
||||||
const allMonthSolarTermNames: Record<string, string[]> = {};
|
const allMonthSolarTermNames: Record<string, string[]> = {};
|
||||||
let currentMonthChineseDays: string[] = [];
|
let currentMonthChineseDays: string[] = [];
|
||||||
@@ -121,7 +121,7 @@ describe('getChineseYearMonthAllDayInfos', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('getChineseYearMonthDayInfo', () => {
|
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) {
|
for (const line of lines) {
|
||||||
if (!line.trim() || line.startsWith('#')) {
|
if (!line.trim() || line.startsWith('#')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user