Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

zipTree.test.ts

12 lines454 Bytes

1import { expect, it } from "vite-plus/test";
2​
3import { zipDownloadTimeLeft } from "./zipTree";
4​
5const timeLeft = (seconds: number) =>
6 zipDownloadTimeLeft({ receivedBytes: 1, totalBytes: 2, elapsedMs: seconds * 1000 });
7​
8it("uses singular units when one minute or one second is left", () => {
9 expect(timeLeft(1)).toBe("About 1 second left");
10 expect(timeLeft(60)).toBe("About 1 minute left");
11 expect(timeLeft(61)).toBe("About 2 minutes left");
12});