@@ -18,8 +18,6 @@ describe('duration', () => {
18
18
( ) => stack . resolve ( lazyDuration . toMinutes ( ) ) ) . toThrow (
19
19
/ U n a b l e t o p e r f o r m t i m e u n i t c o n v e r s i o n o n u n - r e s o l v e d t o k e n / ,
20
20
) ;
21
-
22
-
23
21
} ) ;
24
22
25
23
test ( 'Duration in seconds' , ( ) => {
@@ -31,8 +29,6 @@ describe('duration', () => {
31
29
floatEqual ( duration . toDays ( { integral : false } ) , 300 / 86_400 ) ;
32
30
33
31
expect ( Duration . seconds ( 60 * 60 * 24 ) . toDays ( ) ) . toEqual ( 1 ) ;
34
-
35
-
36
32
} ) ;
37
33
38
34
test ( 'Duration in minutes' , ( ) => {
@@ -44,8 +40,6 @@ describe('duration', () => {
44
40
floatEqual ( duration . toDays ( { integral : false } ) , 300 / 86_400 ) ;
45
41
46
42
expect ( Duration . minutes ( 60 * 24 ) . toDays ( ) ) . toEqual ( 1 ) ;
47
-
48
-
49
43
} ) ;
50
44
51
45
test ( 'Duration in hours' , ( ) => {
@@ -57,16 +51,12 @@ describe('duration', () => {
57
51
floatEqual ( duration . toDays ( { integral : false } ) , 5 / 24 ) ;
58
52
59
53
expect ( Duration . hours ( 24 ) . toDays ( ) ) . toEqual ( 1 ) ;
60
-
61
-
62
54
} ) ;
63
55
64
56
test ( 'seconds to milliseconds' , ( ) => {
65
57
const duration = Duration . seconds ( 5 ) ;
66
58
67
59
expect ( duration . toMilliseconds ( ) ) . toEqual ( 5_000 ) ;
68
-
69
-
70
60
} ) ;
71
61
72
62
test ( 'Duration in days' , ( ) => {
@@ -75,8 +65,6 @@ describe('duration', () => {
75
65
expect ( duration . toSeconds ( ) ) . toEqual ( 86_400 ) ;
76
66
expect ( duration . toMinutes ( ) ) . toEqual ( 1_440 ) ;
77
67
expect ( duration . toDays ( ) ) . toEqual ( 1 ) ;
78
-
79
-
80
68
} ) ;
81
69
82
70
testDeprecated ( 'toISOString' , ( ) => {
@@ -93,8 +81,6 @@ describe('duration', () => {
93
81
expect ( Duration . days ( 5 ) . toISOString ( ) ) . toEqual ( 'P5D' ) ;
94
82
95
83
expect ( Duration . seconds ( 1 + 60 * ( 1 + 60 * ( 1 + 24 ) ) ) . toISOString ( ) ) . toEqual ( 'P1DT1H1M1S' ) ;
96
-
97
-
98
84
} ) ;
99
85
100
86
test ( 'toIsoString' , ( ) => {
@@ -112,8 +98,6 @@ describe('duration', () => {
112
98
113
99
expect ( Duration . seconds ( 65 ) . toIsoString ( ) ) . toEqual ( 'PT1M5S' ) ;
114
100
expect ( Duration . seconds ( 1 + 60 * ( 1 + 60 * ( 1 + 24 ) ) ) . toIsoString ( ) ) . toEqual ( 'P1DT1H1M1S' ) ;
115
-
116
-
117
101
} ) ;
118
102
119
103
test ( 'parse' , ( ) => {
@@ -128,8 +112,6 @@ describe('duration', () => {
128
112
expect ( Duration . parse ( 'P5D' ) . toSeconds ( ) ) . toEqual ( 432_000 ) ;
129
113
130
114
expect ( Duration . parse ( 'P1DT1H1M1S' ) . toSeconds ( ) ) . toEqual ( 1 + 60 * ( 1 + 60 * ( 1 + 24 ) ) ) ;
131
-
132
-
133
115
} ) ;
134
116
135
117
test ( 'reject illegal parses' , ( ) => {
@@ -141,8 +123,6 @@ describe('duration', () => {
141
123
expect ( ( ) => {
142
124
Duration . parse ( 'P5S' ) ;
143
125
} ) . toThrow ( err ) ;
144
-
145
-
146
126
} ) ;
147
127
148
128
test ( 'to human string' , ( ) => {
@@ -165,8 +145,6 @@ describe('duration', () => {
165
145
expect ( Duration . millis ( 3666 ) . toHumanString ( ) ) . toEqual ( '3 seconds 666 millis' ) ;
166
146
167
147
expect ( Duration . millis ( 3.6 ) . toHumanString ( ) ) . toEqual ( '3.6 millis' ) ;
168
-
169
-
170
148
} ) ;
171
149
172
150
test ( 'add two durations' , ( ) => {
@@ -188,7 +166,6 @@ describe('duration', () => {
188
166
expect ( Duration . millis ( 1 ) . unitLabel ( ) ) . toEqual ( 'millis' ) ;
189
167
expect ( Duration . hours ( 1000 ) . unitLabel ( ) ) . toEqual ( 'hours' ) ;
190
168
expect ( Duration . days ( 2 ) . unitLabel ( ) ) . toEqual ( 'days' ) ;
191
-
192
169
} ) ;
193
170
194
171
test ( 'format number token to number' , ( ) => {
@@ -197,14 +174,12 @@ describe('duration', () => {
197
174
expect ( stack . resolve ( lazyDuration . formatTokenToNumber ( ) ) ) . toEqual ( '10 minutes' ) ;
198
175
expect ( Duration . hours ( 10 ) . formatTokenToNumber ( ) ) . toEqual ( '10 hours' ) ;
199
176
expect ( Duration . days ( 5 ) . formatTokenToNumber ( ) ) . toEqual ( '5 days' ) ;
200
-
201
177
} ) ;
202
178
203
179
test ( 'duration is unresolved' , ( ) => {
204
180
const lazyDuration = Duration . minutes ( Lazy . number ( { produce : ( ) => 10 } ) ) ;
205
181
expect ( lazyDuration . isUnresolved ( ) ) . toEqual ( true ) ;
206
182
expect ( Duration . hours ( 10 ) . isUnresolved ( ) ) . toEqual ( false ) ;
207
-
208
183
} ) ;
209
184
} ) ;
210
185
0 commit comments