1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 03:50:04 +08:00
SpaceVim/bundle/neo-tree.nvim/tests/neo-tree/events/queue_spec.lua

29 lines
682 B
Lua
Raw Permalink Normal View History

2023-05-30 21:09:18 +08:00
pcall(require, "luacov")
describe("Event queue", function()
it("should return data when handled = true", function()
local events = require("neo-tree.events")
events.subscribe({
event = "test",
handler = function()
return { data = "first" }
end,
})
events.subscribe({
event = "test",
handler = function()
return { handled = true, data = "second" }
end,
})
events.subscribe({
event = "test",
handler = function()
return { data = "third" }
end,
})
local result = events.fire_event("test") or {}
local data = result.data
assert.are.same("second", data)
end)
end)