lune/tests/roblox/instance/methods/GetChildren.luau

20 lines
567 B
Lua
Raw Normal View History

local fs = require("@lune/fs")
2023-03-25 16:07:08 +00:00
local roblox = require("@lune/roblox") :: any
local Instance = roblox.Instance
local modelFile = fs.readFile("tests/roblox/rbx-test-files/models/three-nested-folders/binary.rbxm")
local model = roblox.deserializeModel(modelFile)[1]
2023-03-25 16:07:08 +00:00
assert(#model:GetChildren() == 1)
local newChild = Instance.new("Model")
newChild.Parent = model
assert(#model:GetChildren() == 2)
assert(table.find(model:GetChildren(), newChild) ~= nil)
newChild:Destroy()
assert(#model:GetChildren() == 1)
assert(table.find(model:GetChildren(), newChild) == nil)