add tests

This commit is contained in:
Mylloon 2024-10-11 18:45:33 +02:00
parent 74fdfb7626
commit 2fcca576a6
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -111,4 +111,18 @@ describe("Relative time", () => {
expect(timeDeltaToString(name)).toMatch(/1w 1d 6h|1w 1d 5h 59m 5\ds/);
});
}
{
// We do +2 because we do -2 in the code to compensate for Discord's latency.
// This gives us the case where (normally) there is a 0s delay.
const name = Date.now() + 2 * 1000;
test(name.toString(), () => {
expect(timeDeltaToString(name)).toMatch(/\ds/);
});
}
{
const name = Date.now();
test(name.toString(), () => {
expect(timeDeltaToString(name)).toMatch(/\ds/);
});
}
});