2022-01-25 22:24:09 +01:00
|
|
|
import { convertTimeMsToTimeElapsedString } from "../../src/utils/StringHelperFunctions";
|
2021-08-27 01:16:38 +02:00
|
|
|
|
|
|
|
describe("StringHelperFunctions Tests", function () {
|
2021-09-05 01:09:30 +02:00
|
|
|
it("transforms strings", () => {
|
2022-09-24 00:13:33 +02:00
|
|
|
expect(convertTimeMsToTimeElapsedString(1000)).toEqual("1 second");
|
2021-12-19 10:42:16 +01:00
|
|
|
expect(convertTimeMsToTimeElapsedString(5 * 60 * 1000 + 34 * 1000)).toEqual("5 minutes 34 seconds");
|
|
|
|
expect(convertTimeMsToTimeElapsedString(2 * 60 * 60 * 24 * 1000 + 5 * 60 * 1000 + 34 * 1000)).toEqual(
|
2021-09-09 05:47:34 +02:00
|
|
|
"2 days 5 minutes 34 seconds",
|
|
|
|
);
|
2021-12-19 10:42:16 +01:00
|
|
|
expect(convertTimeMsToTimeElapsedString(2 * 60 * 60 * 24 * 1000 + 5 * 60 * 1000 + 34 * 1000, true)).toEqual(
|
2021-09-09 05:47:34 +02:00
|
|
|
"2 days 5 minutes 34.000 seconds",
|
|
|
|
);
|
2021-12-19 10:42:16 +01:00
|
|
|
expect(convertTimeMsToTimeElapsedString(2 * 60 * 60 * 24 * 1000 + 5 * 60 * 1000 + 34 * 1000 + 123, true)).toEqual(
|
2021-09-10 06:13:03 +02:00
|
|
|
"2 days 5 minutes 34.123 seconds",
|
|
|
|
);
|
2022-04-07 01:30:08 +02:00
|
|
|
expect(
|
|
|
|
convertTimeMsToTimeElapsedString(2 * 60 * 60 * 24 * 1000 + 5 * 60 * 1000 + 34 * 1000 + 123.888, true),
|
|
|
|
).toEqual("2 days 5 minutes 34.123 seconds");
|
2021-09-05 01:09:30 +02:00
|
|
|
});
|
2021-08-27 01:16:38 +02:00
|
|
|
});
|