lune/tests/roblox/instance/methods/GetDescendants.luau
2023-05-20 19:49:37 +02:00

19 lines
573 B
Text

local fs = require("@lune/fs")
local roblox = require("@lune/roblox")
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]
assert(#model:GetDescendants() == 2)
local newChild = Instance.new("Model")
newChild.Parent = model
assert(#model:GetDescendants() == 3)
assert(table.find(model:GetDescendants(), newChild) == 2)
newChild:Destroy()
assert(#model:GetDescendants() == 2)
assert(table.find(model:GetDescendants(), newChild) == nil)