@@ -6,202 +6,266 @@ describe('Clock', () => {
6
6
expect ( at ( 8 ) . toString ( ) ) . toEqual ( '08:00' ) ;
7
7
} ) ;
8
8
9
- xtest ( 'past the hour' , ( ) => {
9
+ test ( 'past the hour' , ( ) => {
10
10
expect ( at ( 11 , 9 ) . toString ( ) ) . toEqual ( '11:09' ) ;
11
11
} ) ;
12
12
13
- xtest ( 'midnight is zero hours' , ( ) => {
13
+ test ( 'midnight is zero hours' , ( ) => {
14
14
expect ( at ( 24 , 0 ) . toString ( ) ) . toEqual ( '00:00' ) ;
15
15
} ) ;
16
16
17
- xtest ( 'hour rolls over' , ( ) => {
17
+ test ( 'hour rolls over' , ( ) => {
18
18
expect ( at ( 25 , 0 ) . toString ( ) ) . toEqual ( '01:00' ) ;
19
19
} ) ;
20
20
21
- xtest ( 'hour rolls over continuously' , ( ) => {
21
+ test ( 'hour rolls over continuously' , ( ) => {
22
22
expect ( at ( 100 , 0 ) . toString ( ) ) . toEqual ( '04:00' ) ;
23
23
} ) ;
24
24
25
- xtest ( 'sixty minutes is next hour' , ( ) => {
25
+ test ( 'sixty minutes is next hour' , ( ) => {
26
26
expect ( at ( 1 , 60 ) . toString ( ) ) . toEqual ( '02:00' ) ;
27
27
} ) ;
28
28
29
- xtest ( 'minutes roll over' , ( ) => {
29
+ test ( 'minutes roll over' , ( ) => {
30
30
expect ( at ( 0 , 160 ) . toString ( ) ) . toEqual ( '02:40' ) ;
31
31
} ) ;
32
32
33
- xtest ( 'minutes roll over continuously' , ( ) => {
33
+ test ( 'minutes roll over continuously' , ( ) => {
34
34
expect ( at ( 0 , 1723 ) . toString ( ) ) . toEqual ( '04:43' ) ;
35
35
} ) ;
36
36
37
- xtest ( 'hour and minutes roll over' , ( ) => {
37
+ test ( 'hour and minutes roll over' , ( ) => {
38
38
expect ( at ( 25 , 160 ) . toString ( ) ) . toEqual ( '03:40' ) ;
39
39
} ) ;
40
40
41
- xtest ( 'hour and minutes roll over continuously' , ( ) => {
41
+ test ( 'hour and minutes roll over continuously' , ( ) => {
42
42
expect ( at ( 201 , 3001 ) . toString ( ) ) . toEqual ( '11:01' ) ;
43
43
} ) ;
44
44
45
- xtest ( 'hour and minutes roll over to exactly midnight' , ( ) => {
45
+ test ( 'hour and minutes roll over to exactly midnight' , ( ) => {
46
46
expect ( at ( 72 , 8640 ) . toString ( ) ) . toEqual ( '00:00' ) ;
47
47
} ) ;
48
48
49
- xtest ( 'negative hour' , ( ) => {
49
+ test ( 'negative hour' , ( ) => {
50
50
expect ( at ( - 1 , 15 ) . toString ( ) ) . toEqual ( '23:15' ) ;
51
51
} ) ;
52
52
53
- xtest ( 'negative hour rolls over' , ( ) => {
53
+ test ( 'negative hour rolls over' , ( ) => {
54
54
expect ( at ( - 25 , 0 ) . toString ( ) ) . toEqual ( '23:00' ) ;
55
55
} ) ;
56
56
57
- xtest ( 'negative hour rolls over continuously' , ( ) => {
57
+ test ( 'negative hour rolls over continuously' , ( ) => {
58
58
expect ( at ( - 91 , 0 ) . toString ( ) ) . toEqual ( '05:00' ) ;
59
59
} ) ;
60
60
61
- xtest ( 'negative minutes' , ( ) => {
61
+ test ( 'negative minutes' , ( ) => {
62
62
expect ( at ( 1 , - 40 ) . toString ( ) ) . toEqual ( '00:20' ) ;
63
63
} ) ;
64
64
65
- xtest ( 'negative minutes rolls over' , ( ) => {
65
+ test ( 'negative minutes rolls over' , ( ) => {
66
66
expect ( at ( 1 , - 160 ) . toString ( ) ) . toEqual ( '22:20' ) ;
67
67
} ) ;
68
68
69
- xtest ( 'negative minutes rolls over continuously' , ( ) => {
69
+ test ( 'negative minutes rolls over continuously' , ( ) => {
70
70
expect ( at ( 1 , - 4820 ) . toString ( ) ) . toEqual ( '16:40' ) ;
71
71
} ) ;
72
72
73
- xtest ( 'negative hour and minutes both roll over' , ( ) => {
73
+ test ( 'negative hour and minutes both roll over' , ( ) => {
74
74
expect ( at ( - 25 , - 160 ) . toString ( ) ) . toEqual ( '20:20' ) ;
75
75
} ) ;
76
76
77
- xtest ( 'negative hour and minutes both roll over continuously' , ( ) => {
77
+ test ( 'negative hour and minutes both roll over continuously' , ( ) => {
78
78
expect ( at ( - 121 , - 5810 ) . toString ( ) ) . toEqual ( '22:10' ) ;
79
79
} ) ;
80
80
81
81
describe ( 'Adding and subtracting minutes' , ( ) => {
82
- xtest ( 'add minutes' , ( ) => {
83
- expect ( at ( 10 , 0 ) . plus ( 3 ) . toString ( ) ) . toEqual ( '10:03' ) ;
82
+ test ( 'add minutes' , ( ) => {
83
+ expect (
84
+ at ( 10 , 0 )
85
+ . plus ( 3 )
86
+ . toString ( )
87
+ ) . toEqual ( '10:03' ) ;
84
88
} ) ;
85
89
86
- xtest ( 'add no minutes' , ( ) => {
87
- expect ( at ( 6 , 41 ) . plus ( 0 ) . toString ( ) ) . toEqual ( '06:41' ) ;
90
+ test ( 'add no minutes' , ( ) => {
91
+ expect (
92
+ at ( 6 , 41 )
93
+ . plus ( 0 )
94
+ . toString ( )
95
+ ) . toEqual ( '06:41' ) ;
88
96
} ) ;
89
97
90
- xtest ( 'add to next hour' , ( ) => {
91
- expect ( at ( 0 , 45 ) . plus ( 40 ) . toString ( ) ) . toEqual ( '01:25' ) ;
98
+ test ( 'add to next hour' , ( ) => {
99
+ expect (
100
+ at ( 0 , 45 )
101
+ . plus ( 40 )
102
+ . toString ( )
103
+ ) . toEqual ( '01:25' ) ;
92
104
} ) ;
93
105
94
- xtest ( 'add more than one hour' , ( ) => {
95
- expect ( at ( 10 , 0 ) . plus ( 61 ) . toString ( ) ) . toEqual ( '11:01' ) ;
106
+ test ( 'add more than one hour' , ( ) => {
107
+ expect (
108
+ at ( 10 , 0 )
109
+ . plus ( 61 )
110
+ . toString ( )
111
+ ) . toEqual ( '11:01' ) ;
96
112
} ) ;
97
113
98
- xtest ( 'add more than two hours with carry' , ( ) => {
99
- expect ( at ( 0 , 45 ) . plus ( 160 ) . toString ( ) ) . toEqual ( '03:25' ) ;
114
+ test ( 'add more than two hours with carry' , ( ) => {
115
+ expect (
116
+ at ( 0 , 45 )
117
+ . plus ( 160 )
118
+ . toString ( )
119
+ ) . toEqual ( '03:25' ) ;
100
120
} ) ;
101
121
102
- xtest ( 'add across midnight' , ( ) => {
103
- expect ( at ( 23 , 59 ) . plus ( 2 ) . toString ( ) ) . toEqual ( '00:01' ) ;
122
+ test ( 'add across midnight' , ( ) => {
123
+ expect (
124
+ at ( 23 , 59 )
125
+ . plus ( 2 )
126
+ . toString ( )
127
+ ) . toEqual ( '00:01' ) ;
104
128
} ) ;
105
129
106
- xtest ( 'add more than one day (1500 min = 25 hrs)' , ( ) => {
107
- expect ( at ( 5 , 32 ) . plus ( 1500 ) . toString ( ) ) . toEqual ( '06:32' ) ;
130
+ test ( 'add more than one day (1500 min = 25 hrs)' , ( ) => {
131
+ expect (
132
+ at ( 5 , 32 )
133
+ . plus ( 1500 )
134
+ . toString ( )
135
+ ) . toEqual ( '06:32' ) ;
108
136
} ) ;
109
137
110
- xtest ( 'add more than two days' , ( ) => {
111
- expect ( at ( 1 , 1 ) . plus ( 3500 ) . toString ( ) ) . toEqual ( '11:21' ) ;
138
+ test ( 'add more than two days' , ( ) => {
139
+ expect (
140
+ at ( 1 , 1 )
141
+ . plus ( 3500 )
142
+ . toString ( )
143
+ ) . toEqual ( '11:21' ) ;
112
144
} ) ;
113
145
114
- xtest ( 'subtract minutes' , ( ) => {
115
- expect ( at ( 10 , 3 ) . minus ( 3 ) . toString ( ) ) . toEqual ( '10:00' ) ;
146
+ test ( 'subtract minutes' , ( ) => {
147
+ expect (
148
+ at ( 10 , 3 )
149
+ . minus ( 3 )
150
+ . toString ( )
151
+ ) . toEqual ( '10:00' ) ;
116
152
} ) ;
117
153
118
- xtest ( 'subtract to previous hour' , ( ) => {
119
- expect ( at ( 10 , 3 ) . minus ( 30 ) . toString ( ) ) . toEqual ( '09:33' ) ;
154
+ test ( 'subtract to previous hour' , ( ) => {
155
+ expect (
156
+ at ( 10 , 3 )
157
+ . minus ( 30 )
158
+ . toString ( )
159
+ ) . toEqual ( '09:33' ) ;
120
160
} ) ;
121
161
122
- xtest ( 'subtract more than an hour' , ( ) => {
123
- expect ( at ( 10 , 3 ) . minus ( 70 ) . toString ( ) ) . toEqual ( '08:53' ) ;
162
+ test ( 'subtract more than an hour' , ( ) => {
163
+ expect (
164
+ at ( 10 , 3 )
165
+ . minus ( 70 )
166
+ . toString ( )
167
+ ) . toEqual ( '08:53' ) ;
124
168
} ) ;
125
169
126
- xtest ( 'subtract across midnight' , ( ) => {
127
- expect ( at ( 0 , 3 ) . minus ( 4 ) . toString ( ) ) . toEqual ( '23:59' ) ;
170
+ test ( 'subtract across midnight' , ( ) => {
171
+ expect (
172
+ at ( 0 , 3 )
173
+ . minus ( 4 )
174
+ . toString ( )
175
+ ) . toEqual ( '23:59' ) ;
128
176
} ) ;
129
177
130
- xtest ( 'subtract more than two hours' , ( ) => {
131
- expect ( at ( 0 , 0 ) . minus ( 160 ) . toString ( ) ) . toEqual ( '21:20' ) ;
178
+ test ( 'subtract more than two hours' , ( ) => {
179
+ expect (
180
+ at ( 0 , 0 )
181
+ . minus ( 160 )
182
+ . toString ( )
183
+ ) . toEqual ( '21:20' ) ;
132
184
} ) ;
133
185
134
- xtest ( 'subtract more than two hours with borrow' , ( ) => {
135
- expect ( at ( 6 , 15 ) . minus ( 160 ) . toString ( ) ) . toEqual ( '03:35' ) ;
186
+ test ( 'subtract more than two hours with borrow' , ( ) => {
187
+ expect (
188
+ at ( 6 , 15 )
189
+ . minus ( 160 )
190
+ . toString ( )
191
+ ) . toEqual ( '03:35' ) ;
136
192
} ) ;
137
193
138
- xtest ( 'subtract more than one day (1500 min = 25 hrs)' , ( ) => {
139
- expect ( at ( 5 , 32 ) . minus ( 1500 ) . toString ( ) ) . toEqual ( '04:32' ) ;
194
+ test ( 'subtract more than one day (1500 min = 25 hrs)' , ( ) => {
195
+ expect (
196
+ at ( 5 , 32 )
197
+ . minus ( 1500 )
198
+ . toString ( )
199
+ ) . toEqual ( '04:32' ) ;
140
200
} ) ;
141
201
142
- xtest ( 'subtract more than two days' , ( ) => {
143
- expect ( at ( 2 , 20 ) . minus ( 3000 ) . toString ( ) ) . toEqual ( '00:20' ) ;
202
+ test ( 'subtract more than two days' , ( ) => {
203
+ expect (
204
+ at ( 2 , 20 )
205
+ . minus ( 3000 )
206
+ . toString ( )
207
+ ) . toEqual ( '00:20' ) ;
144
208
} ) ;
145
209
} ) ;
146
210
147
211
describe ( 'Construct two separate clocks, set times, test if they are equal' , ( ) => {
148
- xtest ( 'clocks with same time' , ( ) => {
212
+ test ( 'clocks with same time' , ( ) => {
149
213
expect ( at ( 15 , 37 ) . equals ( at ( 15 , 37 ) ) ) . toBeTruthy ( ) ;
150
214
} ) ;
151
215
152
- xtest ( 'clocks a minute apart' , ( ) => {
216
+ test ( 'clocks a minute apart' , ( ) => {
153
217
expect ( at ( 15 , 36 ) . equals ( at ( 15 , 37 ) ) ) . toBeFalsy ( ) ;
154
218
} ) ;
155
219
156
- xtest ( 'clocks an hour apart' , ( ) => {
220
+ test ( 'clocks an hour apart' , ( ) => {
157
221
expect ( at ( 14 , 37 ) . equals ( at ( 15 , 37 ) ) ) . toBeFalsy ( ) ;
158
222
} ) ;
159
223
160
- xtest ( 'clocks with hour overflow' , ( ) => {
224
+ test ( 'clocks with hour overflow' , ( ) => {
161
225
expect ( at ( 10 , 37 ) . equals ( at ( 34 , 37 ) ) ) . toBeTruthy ( ) ;
162
226
} ) ;
163
227
164
- xtest ( 'clocks with hour overflow by several days' , ( ) => {
228
+ test ( 'clocks with hour overflow by several days' , ( ) => {
165
229
expect ( at ( 3 , 11 ) . equals ( at ( 99 , 11 ) ) ) . toBeTruthy ( ) ;
166
230
} ) ;
167
231
168
- xtest ( 'clocks with negative hour' , ( ) => {
232
+ test ( 'clocks with negative hour' , ( ) => {
169
233
expect ( at ( 22 , 40 ) . equals ( at ( - 2 , 40 ) ) ) . toBeTruthy ( ) ;
170
234
} ) ;
171
235
172
- xtest ( 'clocks with negative hour that wraps' , ( ) => {
236
+ test ( 'clocks with negative hour that wraps' , ( ) => {
173
237
expect ( at ( 17 , 3 ) . equals ( at ( - 31 , 3 ) ) ) . toBeTruthy ( ) ;
174
238
} ) ;
175
239
176
- xtest ( 'clocks with negative hour that wraps multiple times' , ( ) => {
240
+ test ( 'clocks with negative hour that wraps multiple times' , ( ) => {
177
241
expect ( at ( 13 , 49 ) . equals ( at ( - 83 , 49 ) ) ) . toBeTruthy ( ) ;
178
242
} ) ;
179
243
180
- xtest ( 'clocks with minute overflow' , ( ) => {
244
+ test ( 'clocks with minute overflow' , ( ) => {
181
245
expect ( at ( 0 , 1 ) . equals ( at ( 0 , 1441 ) ) ) . toBeTruthy ( ) ;
182
246
} ) ;
183
247
184
- xtest ( 'clocks with minute overflow by several days' , ( ) => {
248
+ test ( 'clocks with minute overflow by several days' , ( ) => {
185
249
expect ( at ( 2 , 2 ) . equals ( at ( 2 , 4322 ) ) ) . toBeTruthy ( ) ;
186
250
} ) ;
187
251
188
- xtest ( 'clocks with negative minute' , ( ) => {
252
+ test ( 'clocks with negative minute' , ( ) => {
189
253
expect ( at ( 2 , 40 ) . equals ( at ( 3 , - 20 ) ) ) . toBeTruthy ( ) ;
190
254
} ) ;
191
255
192
- xtest ( 'clocks with negative minute that wraps' , ( ) => {
256
+ test ( 'clocks with negative minute that wraps' , ( ) => {
193
257
expect ( at ( 4 , 10 ) . equals ( at ( 5 , - 1490 ) ) ) . toBeTruthy ( ) ;
194
258
} ) ;
195
259
196
- xtest ( 'clocks with negative minute that wraps multiple times' , ( ) => {
260
+ test ( 'clocks with negative minute that wraps multiple times' , ( ) => {
197
261
expect ( at ( 6 , 15 ) . equals ( at ( 6 , - 4305 ) ) ) . toBeTruthy ( ) ;
198
262
} ) ;
199
263
200
- xtest ( 'clocks with negative hours and minutes' , ( ) => {
264
+ test ( 'clocks with negative hours and minutes' , ( ) => {
201
265
expect ( at ( 7 , 32 ) . equals ( at ( - 12 , - 268 ) ) ) . toBeTruthy ( ) ;
202
266
} ) ;
203
267
204
- xtest ( 'clocks with negative hours and minutes that wrap' , ( ) => {
268
+ test ( 'clocks with negative hours and minutes that wrap' , ( ) => {
205
269
expect ( at ( 18 , 7 ) . equals ( at ( - 54 , - 11513 ) ) ) . toBeTruthy ( ) ;
206
270
} ) ;
207
271
} ) ;
0 commit comments