Skip to content

Commit

Permalink
test: repair eslint_d tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sQVe committed Oct 13, 2023
1 parent 0a5f2a8 commit b2a8edd
Showing 1 changed file with 24 additions and 35 deletions.
59 changes: 24 additions & 35 deletions tests/eslint_d_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,31 @@ describe("linter.eslint_d", function()
local parser = require("lint.linters.eslint_d").parser

local result = parser([[
{
messages = {
{
column = 10,
endColumn = 18,
endLine = 1,
line = 1,
message = "'testFunc' is defined but never used",
ruleId = "no-unused-vars",
severity = 2
},
{
column = 16,
endColumn = 22,
endLine = 4,
line = 4,
message =
"This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain no-dupe-else-if",
ruleId = "no-dupe-else-if",
severity = 2
}
},
}
]], vim.api.nvim_get_current_buf()
)
{
"messages": [
{
"column": 10,
"endColumn": 18,
"endLine": 1,
"line": 1,
"message": "'testFunc' is defined but never used",
"ruleId": "no-unused-vars",
"severity": 2
},
{
"column": 16,
"endColumn": 22,
"endLine": 4,
"line": 4,
"message": "This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain",
"ruleId": "no-dupe-else-if",
"severity": 2
}
]
}]])

assert.are.same(2, #result)

local expected_1 = {
code = "no-unused-vars",
col = 9,
Expand All @@ -44,11 +43,6 @@ describe("linter.eslint_d", function()
message = "'testFunc' is defined but never used",
severity = 1,
source = "eslint_d",
user_data = {
lsp = {
code = "no-unused-vars",
},
},
}
assert.are.same(expected_1, result[1])

Expand All @@ -62,11 +56,6 @@ describe("linter.eslint_d", function()
"This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain",
severity = 1,
source = "eslint_d",
user_data = {
lsp = {
code = "no-dupe-else-if",
},
},
}
assert.are.same(expected_2, result[2])
end)
Expand Down

0 comments on commit b2a8edd

Please sign in to comment.