Return empty array instead of undefined in mapTimestampToAxisTicksByFormat
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -251,4 +251,5 @@ export const mapTimestampToAxisTicksByFormat = (timeStampArr, timeFormat) => {
|
|||||||
if (timeStampArr) {
|
if (timeStampArr) {
|
||||||
return timeStampArr.map((ts) => moment(ts).format(timeFormat));
|
return timeStampArr.map((ts) => moment(ts).format(timeFormat));
|
||||||
}
|
}
|
||||||
|
return [];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ describe("mapTimestampToAxisTicksByFormat", () => {
|
|||||||
expect(result[0]).toBe("2023/01/15");
|
expect(result[0]).toBe("2023/01/15");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns undefined for falsy input", () => {
|
it("returns empty array for falsy input", () => {
|
||||||
expect(mapTimestampToAxisTicksByFormat(null, "YYYY")).toBeUndefined();
|
expect(mapTimestampToAxisTicksByFormat(null, "YYYY")).toEqual([]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user