@@ -6,10 +6,7 @@ import {
66formatExpiresInLabel ,
77formatRelativeTime ,
88formatRelativeTimeLabel ,
9- formatRelativeTimeUntil ,
10- formatRelativeTimeUntilLabel ,
119formatShortTimestamp ,
12- formatTimestamp ,
1310getRelativeTimeState ,
1411getTimestampFormatOptions ,
1512resolveTimestampLocale ,
@@ -76,33 +73,6 @@ describe("resolveTimestampLocale", () => {
7673} ) ;
7774} ) ;
7875
79- describe ( "formatRelativeTimeUntilLabel" , ( ) => {
80- beforeEach ( ( ) => {
81- vi . useFakeTimers ( ) ;
82- vi . setSystemTime ( new Date ( "2026-04-07T12:00:00.000Z" ) ) ;
83- } ) ;
84-
85- afterEach ( ( ) => {
86- vi . useRealTimers ( ) ;
87- } ) ;
88-
89- it ( "returns Expired when the instant is in the past" , ( ) => {
90- expect ( formatRelativeTimeUntilLabel ( "2026-04-07T11:59:00.000Z" ) ) . toBe ( "Expired" ) ;
91- } ) ;
92-
93- it ( "formats seconds remaining" , ( ) => {
94- expect ( formatRelativeTimeUntilLabel ( "2026-04-07T12:00:45.000Z" ) ) . toBe ( "45s left" ) ;
95- } ) ;
96-
97- it ( "formats minutes remaining" , ( ) => {
98- expect ( formatRelativeTimeUntilLabel ( "2026-04-07T12:15:00.000Z" ) ) . toBe ( "15m left" ) ;
99- } ) ;
100-
101- it ( "formats hours remaining" , ( ) => {
102- expect ( formatRelativeTimeUntilLabel ( "2026-04-07T18:00:00.000Z" ) ) . toBe ( "6h left" ) ;
103- } ) ;
104- } ) ;
105-
10676describe ( "formatExpiresInLabel" , ( ) => {
10777beforeEach ( ( ) => {
10878vi . useFakeTimers ( ) ;
@@ -196,10 +166,6 @@ describe("formatDayAwareTimestamp", () => {
196166} ) ;
197167
198168describe ( "invalid timestamp inputs" , ( ) => {
199- it ( "returns an empty timestamp instead of throwing" , ( ) => {
200- expect ( formatTimestamp ( "not-a-date" , "12-hour" ) ) . toBe ( "" ) ;
201- } ) ;
202-
203169it ( "returns an empty short timestamp instead of throwing" , ( ) => {
204170expect ( formatShortTimestamp ( "not-a-date" , "12-hour" ) ) . toBe ( "" ) ;
205171} ) ;
@@ -218,11 +184,6 @@ describe("invalid timestamp inputs", () => {
218184expect ( formatElapsedDurationLabel ( "not-a-date" ) ) . toBe ( "" ) ;
219185} ) ;
220186
221- it ( "returns an empty relative time until label instead of a NaN label" , ( ) => {
222- expect ( formatRelativeTimeUntil ( "not-a-date" ) ) . toBeNull ( ) ;
223- expect ( formatRelativeTimeUntilLabel ( "not-a-date" ) ) . toBe ( "" ) ;
224- } ) ;
225-
226187it ( "returns an empty expires-in label instead of a NaN label" , ( ) => {
227188expect ( formatExpiresInLabel ( "not-a-date" ) ) . toBe ( "" ) ;
228189} ) ;
0 commit comments