electric/mods/ebiometrees/tests/ebiometrees_api_spec.lua
Aleksey Chubukov 940592395d tree test
2023-05-11 02:39:08 +03:00

41 lines
902 B
Lua

package.path = "../?.lua;" .. package.path
_G.ebiometrees = {}
require("api")
require("tree")
require("sapling")
registries={}
function _G.ebiometrees.register_tree_trunks(m, n, d)
registries.trunks = m..":"..n
end
function _G.ebiometrees.register_tree_sprout(m, n, d)
registries.sprout = m..":"..n
end
function _G.ebiometrees.register_tree_leaves(m, n, d)
registries.leaves = m..":"..n
end
function _G.ebiometrees.register_tree_sapling(m, n, d)
registries.sapling = m..":"..n
end
testtree = {
groups = { foo = 1}
}
describe("Trees", function()
it("can register tree", function()
assert.is_nil(ebiometrees.registered_trees["test:tree"])
ebiometrees.register_tree("test:tree", testtree)
assert.is_not_nil(ebiometrees.registered_trees["test:tree"])
end)
it("attempts to register sapling", function()
assert.is_equal("test:tree", registries.sapling)
end)
end)