lune/tests/roblox/instance/classes/DataModel.luau

30 lines
886 B
Lua

local roblox = require("@lune/roblox") :: any
local Instance = roblox.Instance
local game = Instance.new("DataModel")
-- Workspace should always exist as a "Workspace" property, or be created when accessed
assert(game.Workspace ~= nil)
assert(game.Workspace:IsA("Workspace"))
assert(game.Workspace == game:FindFirstChildOfClass("Workspace"))
-- GetService and FindService should work, GetService should create services that don't exist
assert(game:FindService("CSGDictionaryService") == nil)
assert(game:GetService("CSGDictionaryService") ~= nil)
assert(game:FindService("CSGDictionaryService") ~= nil)
-- Service names should be strict and not allow weird characters or substrings
assert(not pcall(function()
game:GetService("wrorokspacey")
end))
assert(not pcall(function()
game:GetService("Work-space")
end))
assert(not pcall(function()
game:GetService("workspac")
end))