@schukai/monster 3.92.3 → 3.94.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,33 @@
1
+
2
+
3
+ import {expect} from "chai"
4
+ import {formatTimeAgo} from "../../../source/i18n/time-ago.mjs";
5
+
6
+ describe('formatTimeAgo', () => {
7
+ it('returns "just now" for times less than a second ago', () => {
8
+ const now = new Date();
9
+ expect(formatTimeAgo(now, 'en')).to.equal('just now');
10
+ });
11
+
12
+ it('returns "in 1 second" for one second in the future', () => {
13
+ const oneSecondFuture = new Date(Date.now() + 1000);
14
+ expect(formatTimeAgo(oneSecondFuture, 'en')).to.equal('in 1 second');
15
+ });
16
+
17
+ it('returns "1 second ago" for one second in the past', () => {
18
+ const oneSecondPast = new Date(Date.now() - 1000);
19
+ expect(formatTimeAgo(oneSecondPast, 'en')).to.equal('1 second ago');
20
+ });
21
+
22
+ it('returns "in 1 minute, 30 seconds" for 90 seconds in the future', () => {
23
+ const ninetySecondsFuture = new Date(Date.now() + 90000);
24
+ expect(formatTimeAgo(ninetySecondsFuture, 'en')).to.equal('in 1 minute and 30 seconds');
25
+ });
26
+
27
+ it('returns "1 minute, 30 seconds ago" for 90 seconds in the past', () => {
28
+ const ninetySecondsPast = new Date(Date.now() - 90000);
29
+ expect(formatTimeAgo(ninetySecondsPast, 'en')).to.equal('1 minute and 30 seconds ago');
30
+ });
31
+
32
+ // Weitere Tests können hinzugefügt werden
33
+ });