Skip to content

Commit 6a9e34e

Browse files
chore(tests): attempt to fix flaky tests
1 parent 689f20a commit 6a9e34e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: tests/plenary/ui/clock_spec.lua

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ describe('Clock', function()
1717
})
1818
table.insert(files, first_file.filename)
1919
vim.fn.cursor(3, 1)
20+
local now = Date.now({ active = false }):to_wrapped_string()
2021
vim.cmd([[norm ,oxi]])
2122
vim.wait(100)
22-
local now = Date.now({ active = false }):to_wrapped_string()
2323
assert.are.same(' :LOGBOOK:', vim.fn.getline(5))
2424
assert.are.same(string.format(' CLOCK: %s', now), vim.fn.getline(6))
2525
assert.are.same(' :END:', vim.fn.getline(7))
@@ -51,9 +51,9 @@ describe('Clock', function()
5151
table.insert(files, second_file.filename)
5252

5353
vim.fn.cursor(3, 1)
54+
local now = Date.now({ active = false }):to_wrapped_string()
5455
vim.cmd([[norm ,oxi]])
5556
vim.wait(100) -- wait for promise to fulfill
56-
local now = Date.now({ active = false }):to_wrapped_string()
5757
assert.are.same(' :LOGBOOK:', vim.fn.getline(8))
5858
assert.are.same(string.format(' CLOCK: %s', now), vim.fn.getline(9))
5959
assert.are.same(' :END:', vim.fn.getline(10))
@@ -86,9 +86,9 @@ describe('Clock', function()
8686

8787
table.insert(files, third_file.filename)
8888
vim.fn.cursor(3, 1)
89+
local now = Date.now({ active = false }):to_wrapped_string()
8990
vim.cmd([[norm ,oxi]])
9091
vim.wait(100) -- wait for promise to fulfill
91-
local now = Date.now({ active = false }):to_wrapped_string()
9292
assert.are.same(' :LOGBOOK:', vim.fn.getline(5))
9393
assert.are.same(string.format(' CLOCK: %s', now), vim.fn.getline(6))
9494
assert.are.same(' :END:', vim.fn.getline(7))
@@ -115,9 +115,9 @@ describe('Clock', function()
115115
vim.cmd.edit(files[1])
116116
local old_clock_line = vim.fn.getline(6)
117117
vim.fn.cursor(3, 1)
118+
local now = Date.now({ active = false }):to_wrapped_string()
118119
vim.cmd([[norm ,oxi]])
119120
vim.wait(100) -- wait for promise to fulfill
120-
local now = Date.now({ active = false }):to_wrapped_string()
121121
assert.are.same(' :LOGBOOK:', vim.fn.getline(5))
122122
assert.are.same(string.format(' CLOCK: %s', now), vim.fn.getline(6))
123123
assert.are.same(old_clock_line, vim.fn.getline(7))
@@ -138,9 +138,9 @@ describe('Clock', function()
138138
' DEADLINE: <2021-07-21 Wed 22:02>',
139139
})
140140
vim.fn.cursor(3, 1)
141+
local now = Date.now({ active = false }):to_wrapped_string()
141142
vim.cmd([[norm ,oxi]])
142143
vim.wait(100) -- wait for promise to fulfill
143-
local now = Date.now({ active = false }):to_wrapped_string()
144144
assert.are.same(' :LOGBOOK:', vim.fn.getline(5))
145145
assert.are.same(string.format(' CLOCK: %s', now), vim.fn.getline(6))
146146
assert.are.same(' :END:', vim.fn.getline(7))

0 commit comments

Comments
 (0)