parkhojeong commented on code in PR #66560:
URL: https://github.com/apache/airflow/pull/66560#discussion_r3203543220
##########
airflow-core/src/airflow/ui/src/utils/datetimeUtils.test.ts:
##########
@@ -69,11 +73,24 @@ describe("getDuration", () => {
const start = "2024-03-14T10:00:00.000Z";
- expect(getDuration(start, null)).toBe("00:00:10.000");
- expect(getDuration(start, undefined)).toBe("00:00:10.000");
+ expect(getDuration(start, null)).toBe("00:00:10");
+ expect(getDuration(start, undefined)).toBe("00:00:10");
vi.useRealTimers();
});
+
+ it("handles both numbers and duration objects", () => {
+ expect(renderDuration(dayjs.duration(10, "seconds"))).toBe("00:00:10");
+ expect(renderDuration(10)).toBe("00:00:10");
+ });
+
+ it("handles floating point milliseconds", () => {
+ expect(renderDuration(dayjs.duration(10.000_499_738,
"seconds"))).toBe("00:00:10");
+ expect(renderDuration(10.000_499_738)).toBe("00:00:10");
+
Review Comment:
```suggestion
expect(renderDuration(dayjs.duration(10.000_500,
"seconds"))).toBe("00:00:10.001");
expect(renderDuration(10.000_500)).toBe("00:00:10.001");
```
This is mostly covered by the `10.838_999_738` case, but could we also add
an explicit half-millisecond boundary case?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]