Skip to content

Commit dadf665

Browse files
committed
fix(test): update tag_content_spec for new name handling
1 parent d9600cd commit dadf665

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

tests/grapple/tag_content_spec.lua

+29-20
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
local App = require("grapple.app")
12
local TagContent = require("grapple.tag_content")
23

34
describe("TagContent", function()
@@ -19,39 +20,47 @@ describe("TagContent", function()
1920
{ 5, "/000 " },
2021
{ 5, "/000 /some_path" },
2122

22-
-- ID + name
23-
{ 9, "/001 bob /some_path" },
24-
{ 9, "/002 bob bob" },
25-
{ 9, "/003 bob bob " },
26-
{ 9, "/004 bob " },
27-
{ 7, "/005 a /some_path" },
28-
{ 7, "/006 a " },
29-
{ 7, "/007 a " },
23+
-- Assumed behaviour (last part editable)
24+
{ 5, "/000 /some_path /another_path" },
25+
}
26+
27+
for _, test_case in ipairs(test_cases) do
28+
local expected = test_case[1]
29+
local line = test_case[2]
30+
31+
it(string.format('expected col %d, line "%s"', expected, line), function()
32+
local empty = function() end
33+
local app = App:new()
34+
app:update({ scope = "global", icons = false })
3035

36+
assert.is_same(
37+
expected,
38+
TagContent:new(app, assert(app:current_scope()), empty, empty, empty):minimum_column(line)
39+
)
40+
end)
41+
end
42+
43+
local test_cases_icons = {
3144
-- ID + icon
3245
{ 9, "/001  /some_path" },
3346
{ 9, "/002  /some_path" },
3447
{ 9, "/003  /some_path" },
3548
{ 9, "/004  " },
3649
{ 9, "/005  " },
37-
38-
-- ID + icon + name
39-
{ 13, "/001  bob /some_path" },
40-
{ 13, "/002  bob " },
41-
{ 11, "/003  c /some_path" },
42-
{ 11, "/004  c " },
43-
{ 11, "/005  c " },
44-
45-
-- Assumed behaviour (last part editable)
46-
{ 16, "/000 /some_path /another_path" },
4750
}
4851

49-
for _, test_case in ipairs(test_cases) do
52+
for _, test_case in ipairs(test_cases_icons) do
5053
local expected = test_case[1]
5154
local line = test_case[2]
5255

5356
it(string.format('expected col %d, line "%s"', expected, line), function()
54-
assert.same(expected, TagContent:new(nil, nil, nil, nil):minimum_column(line))
57+
local empty = function() end
58+
local app = App:new()
59+
app:update({ scope = "global", icons = true })
60+
assert.is_same(
61+
expected,
62+
TagContent:new(app, assert(app:current_scope()), empty, empty, empty):minimum_column(line)
63+
)
5564
end)
5665
end
5766
end)

0 commit comments

Comments
 (0)