Testing Millisecond Time Formatting Implementation in OpenHands
This test suite validates the formatMs utility function that converts milliseconds into a formatted time string. The tests verify proper time formatting across different durations, ensuring accurate conversion of milliseconds to minutes and seconds format.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
all-hands-ai/openhands
frontend/__tests__/utils/format-ms.test.ts
import { test, expect } from "vitest";
import { formatMs } from "../../src/utils/format-ms";
test("formatMs", () => {
expect(formatMs(1000)).toBe("00:01");
expect(formatMs(1000 * 60)).toBe("01:00");
expect(formatMs(1000 * 60 * 2.5)).toBe("02:30");
expect(formatMs(1000 * 60 * 12)).toBe("12:00");
});