@@ -19,12 +19,13 @@ describe('Todo mappings', function()
19
19
' DEADLINE: <2021-07-21 Wed 22:02>' ,
20
20
}, vim .api .nvim_buf_get_lines (0 , 2 , 4 , false ))
21
21
vim .fn .cursor (3 , 1 )
22
+ local now = Date .now ()
22
23
23
24
-- Changing to DONE and adding closed date
24
25
vim .cmd ([[ norm cit]] )
25
26
assert .are .same ({
26
27
' * DONE Test orgmode' ,
27
- ' DEADLINE: <2021-07-21 Wed 22:02> CLOSED: [' .. Date . now () :to_string () .. ' ]' ,
28
+ ' DEADLINE: <2021-07-21 Wed 22:02> CLOSED: [' .. now :to_string () .. ' ]' ,
28
29
}, vim .api .nvim_buf_get_lines (0 , 2 , 4 , false ))
29
30
30
31
-- Removing todo keyword and removing closed date
@@ -59,15 +60,16 @@ describe('Todo mappings', function()
59
60
' * TODO Another task' ,
60
61
}, vim .api .nvim_buf_get_lines (0 , 2 , 6 , false ))
61
62
vim .fn .cursor (3 , 1 )
63
+ local now = Date .now ()
62
64
vim .cmd ([[ norm cit]] )
63
65
vim .wait (50 )
64
66
assert .are .same ({
65
67
' * TODO Test orgmode' ,
66
68
' DEADLINE: <2021-09-14 Tue 12:00 +1w>' ,
67
69
' :PROPERTIES:' ,
68
- ' :LAST_REPEAT: [' .. Date . now () :to_string () .. ' ]' ,
70
+ ' :LAST_REPEAT: [' .. now :to_string () .. ' ]' ,
69
71
' :END:' ,
70
- ' - State "DONE" from "TODO" [' .. Date . now () :to_string () .. ' ]' ,
72
+ ' - State "DONE" from "TODO" [' .. now :to_string () .. ' ]' ,
71
73
' ' ,
72
74
' * TODO Another task' ,
73
75
}, vim .api .nvim_buf_get_lines (0 , 2 , 10 , false ))
@@ -125,33 +127,35 @@ describe('Todo mappings', function()
125
127
' * TODO Another task' ,
126
128
}, vim .api .nvim_buf_get_lines (0 , 2 , 6 , false ))
127
129
vim .fn .cursor (3 , 1 )
130
+ local now = Date .now ()
128
131
vim .cmd ([[ norm cit]] )
129
132
vim .wait (50 )
130
133
assert .are .same ({
131
134
' * TODO Test orgmode' ,
132
135
' DEADLINE: <2021-09-14 Tue 12:00 +1w>' ,
133
136
' :PROPERTIES:' ,
134
- ' :LAST_REPEAT: [' .. Date . now () :to_string () .. ' ]' ,
137
+ ' :LAST_REPEAT: [' .. now :to_string () .. ' ]' ,
135
138
' :END:' ,
136
139
' :LOGBOOK:' ,
137
- ' - State "DONE" from "TODO" [' .. Date . now () :to_string () .. ' ]' ,
140
+ ' - State "DONE" from "TODO" [' .. now :to_string () .. ' ]' ,
138
141
' :END:' ,
139
142
' ' ,
140
143
' * TODO Another task' ,
141
144
}, vim .api .nvim_buf_get_lines (0 , 2 , 12 , false ))
142
145
143
146
vim .fn .cursor (3 , 1 )
147
+ local now = Date .now ()
144
148
vim .cmd ([[ norm cit]] )
145
149
vim .wait (200 )
146
150
assert .are .same ({
147
151
' * TODO Test orgmode' ,
148
152
' DEADLINE: <2021-09-21 Tue 12:00 +1w>' ,
149
153
' :PROPERTIES:' ,
150
- ' :LAST_REPEAT: [' .. Date . now () :to_string () .. ' ]' ,
154
+ ' :LAST_REPEAT: [' .. now :to_string () .. ' ]' ,
151
155
' :END:' ,
152
156
' :LOGBOOK:' ,
153
- ' - State "DONE" from "TODO" [' .. Date . now () :to_string () .. ' ]' ,
154
- ' - State "DONE" from "TODO" [' .. Date . now () :to_string () .. ' ]' ,
157
+ ' - State "DONE" from "TODO" [' .. now :to_string () .. ' ]' ,
158
+ ' - State "DONE" from "TODO" [' .. now :to_string () .. ' ]' ,
155
159
' :END:' ,
156
160
' ' ,
157
161
' * TODO Another task' ,
@@ -179,11 +183,12 @@ describe('Todo mappings', function()
179
183
' DEADLINE: <2021-07-21 Wed 22:02>' ,
180
184
}, vim .api .nvim_buf_get_lines (0 , 2 , 4 , false ))
181
185
186
+ local now = Date .now ()
182
187
-- Changing to DONE and adding closed date
183
188
vim .cmd ([[ norm ciT]] )
184
189
assert .are .same ({
185
190
' * DONE Test orgmode' ,
186
- ' DEADLINE: <2021-07-21 Wed 22:02> CLOSED: [' .. Date . now () :to_string () .. ' ]' ,
191
+ ' DEADLINE: <2021-07-21 Wed 22:02> CLOSED: [' .. now :to_string () .. ' ]' ,
187
192
}, vim .api .nvim_buf_get_lines (0 , 2 , 4 , false ))
188
193
189
194
-- Setting TODO keyword, initial state
@@ -211,10 +216,11 @@ describe('Todo mappings', function()
211
216
' <2021-07-21 Wed 22:02>' ,
212
217
})
213
218
vim .fn .cursor ({ 3 , 1 })
219
+ local now = Date .now ()
214
220
vim .cmd ([[ norm cit]] )
215
221
assert .are .same ({
216
222
' * DONE Test orgmode' ,
217
- ' CLOSED: [' .. Date . now () :to_string () .. ' ]' ,
223
+ ' CLOSED: [' .. now :to_string () .. ' ]' ,
218
224
' <2021-07-21 Wed 22:02>' ,
219
225
}, vim .api .nvim_buf_get_lines (0 , 2 , 5 , false ))
220
226
end )
@@ -266,16 +272,17 @@ describe('Todo mappings', function()
266
272
}, vim .api .nvim_buf_get_lines (0 , 2 , 7 , false ))
267
273
vim .fn .cursor (3 , 3 )
268
274
vim .cmd ([[ norm citd]] )
275
+ local now = Date .now ()
269
276
vim .wait (50 )
270
277
assert .are .same ({
271
278
' * PHONECALL Call dad' ,
272
279
' SCHEDULED: <2021-09-08 Wed 12:00 +1d>' ,
273
280
' :PROPERTIES:' ,
274
281
' :REPEAT_TO_STATE: PHONECALL' ,
275
- ' :LAST_REPEAT: [' .. Date . now () :to_string () .. ' ]' ,
282
+ ' :LAST_REPEAT: [' .. now :to_string () .. ' ]' ,
276
283
' :END:' ,
277
284
' :LOGBOOK:' ,
278
- ' - State "DONE" from "PHONECALL" [' .. Date . now () :to_string () .. ' ]' ,
285
+ ' - State "DONE" from "PHONECALL" [' .. now :to_string () .. ' ]' ,
279
286
' :END:' ,
280
287
}, vim .api .nvim_buf_get_lines (0 , 2 , 11 , false ))
281
288
end )
@@ -300,17 +307,18 @@ describe('Todo mappings', function()
300
307
}, vim .api .nvim_buf_get_lines (0 , 2 , 4 , false ))
301
308
302
309
vim .fn .cursor (3 , 3 )
310
+ local now = Date .now ()
303
311
vim .cmd ([[ norm citd]] )
304
312
vim .wait (50 )
305
313
306
314
assert .are .same ({
307
315
' * MEET Daily stand-up with the team' ,
308
316
' SCHEDULED: <2021-09-08 Wed 09:00 +1d>' ,
309
317
' :PROPERTIES:' ,
310
- ' :LAST_REPEAT: [' .. Date . now () :to_string () .. ' ]' ,
318
+ ' :LAST_REPEAT: [' .. now :to_string () .. ' ]' ,
311
319
' :END:' ,
312
320
' :LOGBOOK:' ,
313
- ' - State "DONE" from "MEET" [' .. Date . now () :to_string () .. ' ]' ,
321
+ ' - State "DONE" from "MEET" [' .. now :to_string () .. ' ]' ,
314
322
' :END:' ,
315
323
}, vim .api .nvim_buf_get_lines (0 , 2 , 10 , false ))
316
324
end )
@@ -341,6 +349,7 @@ describe('Todo mappings', function()
341
349
}, vim .api .nvim_buf_get_lines (0 , 2 , 7 , false ))
342
350
343
351
vim .fn .cursor (3 , 3 )
352
+ local now = Date .now ()
344
353
vim .cmd ([[ norm citd]] )
345
354
vim .wait (50 )
346
355
@@ -349,10 +358,10 @@ describe('Todo mappings', function()
349
358
' SCHEDULED: <2021-09-08 Wed 09:00 +1d>' ,
350
359
' :PROPERTIES:' ,
351
360
' :REPEAT_TO_STATE: PHONECALL' ,
352
- ' :LAST_REPEAT: [' .. Date . now () :to_string () .. ' ]' ,
361
+ ' :LAST_REPEAT: [' .. now :to_string () .. ' ]' ,
353
362
' :END:' ,
354
363
' :LOGBOOK:' ,
355
- ' - State "DONE" from "MEET" [' .. Date . now () :to_string () .. ' ]' ,
364
+ ' - State "DONE" from "MEET" [' .. now :to_string () .. ' ]' ,
356
365
' :END:' ,
357
366
}, vim .api .nvim_buf_get_lines (0 , 2 , 11 , false ))
358
367
end )
@@ -383,6 +392,7 @@ describe('Todo mappings', function()
383
392
}, vim .api .nvim_buf_get_lines (0 , 2 , 7 , false ))
384
393
385
394
vim .fn .cursor (3 , 3 )
395
+ local now = Date .now ()
386
396
vim .cmd ([[ norm citd]] )
387
397
vim .wait (50 )
388
398
@@ -391,10 +401,10 @@ describe('Todo mappings', function()
391
401
' SCHEDULED: <2021-09-08 Wed 09:00 +1d>' ,
392
402
' :PROPERTIES:' ,
393
403
' :REPEAT_TO_STATE: PHONECALL' ,
394
- ' :LAST_REPEAT: [' .. Date . now () :to_string () .. ' ]' ,
404
+ ' :LAST_REPEAT: [' .. now :to_string () .. ' ]' ,
395
405
' :END:' ,
396
406
' :LOGBOOK:' ,
397
- ' - State "DONE" from "MEET" [' .. Date . now () :to_string () .. ' ]' ,
407
+ ' - State "DONE" from "MEET" [' .. now :to_string () .. ' ]' ,
398
408
' :END:' ,
399
409
}, vim .api .nvim_buf_get_lines (0 , 2 , 11 , false ))
400
410
end )
0 commit comments