Skip to content

Commit 719ef2e

Browse files
authored
tests: fix flaky test cases (#48)
1 parent b1bb5e2 commit 719ef2e

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

spec/parse_spec.lua

+8-16
Original file line numberDiff line numberDiff line change
@@ -119,28 +119,20 @@ version = "1.0.0"
119119
result.rocks = {
120120
neorg = { version = "2.0.0", pin = true },
121121
}
122-
local expected = [[
123-
[rocks]
124-
125-
[rocks.neorg]
126-
version = "2.0.0"
127-
pin = true
128-
]]
129-
assert.equal(expected, tostring(result))
122+
local result_str = tostring(result)
123+
assert.is_not_nil(result_str:find("%[rocks.neorg]"))
124+
assert.is_not_nil(result_str:find('version = "2.0.0"'))
125+
assert.is_not_nil(result_str:find("pin = true"))
130126
end)
131127
it("Can add entire table", function()
132128
local result = toml_edit.parse([[]])
133129
result.rocks = {
134130
neorg = { version = "2.0.0", pin = true },
135131
}
136-
local expected = [[
137-
[rocks]
138-
139-
[rocks.neorg]
140-
version = "2.0.0"
141-
pin = true
142-
]]
143-
assert.equal(expected, tostring(result))
132+
local result_str = tostring(result)
133+
assert.is_not_nil(result_str:find("%[rocks.neorg]"))
134+
assert.is_not_nil(result_str:find('version = "2.0.0"'))
135+
assert.is_not_nil(result_str:find("pin = true"))
144136
end)
145137
it("Can set value in array", function()
146138
local toml_content = [[

0 commit comments

Comments
 (0)