electric/mods/ebiometrees/tests/ebiometrees_api_spec.lua

41 lines
902 B
Lua
Raw Permalink Normal View History

2023-05-10 23:39:08 +00:00
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)