Skip to content

Commit 7fab341

Browse files
author
Alec Stewart
committed
fix(capture): update tests.
1 parent 72d4462 commit 7fab341

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

tests/plenary/capture/templates_spec.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,8 @@ describe('Capture template', function()
134134
assert.are.same({ '* TODO ' }, template:compile():wait())
135135
end)
136136
end)
137-
138137
it('should complete %^g from target file tags only', function()
139-
local files = helpers.create_agenda_files({
138+
local fixtures, org_files = helpers.create_agenda_files({
140139
{
141140
filename = 'target.org',
142141
content = {
@@ -158,14 +157,15 @@ describe('Capture template', function()
158157
end, function()
159158
local template = Template:new({
160159
template = '* TODO %^g',
161-
target = files['target.org'],
160+
target = fixtures['target.org'],
162161
})
162+
template.files = org_files
163163
assert.are.same({ '* TODO :target_headline:' }, template:compile():wait())
164164
end)
165165
end)
166166

167167
it('should complete %^G from all loaded agenda file tags', function()
168-
helpers.create_agenda_files({
168+
local _, org_files = helpers.create_agenda_files({
169169
{
170170
filename = 'target.org',
171171
content = {
@@ -188,6 +188,7 @@ describe('Capture template', function()
188188
local template = Template:new({
189189
template = '* TODO %^G',
190190
})
191+
template.files = org_files
191192
assert.are.same({ '* TODO :target_headline:other_headline:' }, template:compile():wait())
192193
end)
193194
end)

tests/plenary/helpers.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ end
6060

6161
---@param fixtures {filename: string, content: string[] }[]
6262
---@param config? table
63-
---@return table
63+
---@return table, OrgFiles
6464
function M.create_agenda_files(fixtures, config)
6565
-- NOTE: content is only 1 line for 1 file
6666
local temp_fname = vim.fn.tempname()
@@ -85,7 +85,7 @@ function M.create_agenda_files(fixtures, config)
8585
}, config or {})
8686
local org = orgmode.setup(cfg)
8787
org:init()
88-
return files
88+
return files, org.files
8989
end
9090

9191
return M

0 commit comments

Comments
 (0)