package.path="\046\047\063\047\105\110\105\116\046\108\117\097\059"..package.path local q=require("\108\105\098")describe("\076\101\109\117\114",function()it("\115\104\111\117\108\100 \108\111\097\100 \102\111\108\100\101\114\115 \099\111\114\114\101\099\116\108\121",function()local Z=q.Habitat:new()local S=Z:loadFromFs("\115\112\101\099\047\116\101\115\116-\112\114\111\106\101\099\116")assert.equal(#S:GetChildren(),3)local B=S:FindFirstChild("\098\097\114")local C=S:FindFirstChild("\117\115\117\114\112")local Y=S:FindFirstChild("\110\111\114\109\097\108-\102\111\108\100\101\114")assert.equal(B.ClassName,"\077\111\100\117\108\101\083\099\114\105\112\116")assert.equal(C.ClassName,"\077\111\100\117\108\101\083\099\114\105\112\116")assert.equal(Y.ClassName,"\070\111\108\100\101\114")assert.equal(B.Source,"-- \098\097\114\046\108\117\097")assert.equal(C.Source,"-- \105\110\105\116\046\108\117\097")assert.equal(#C:GetChildren(),1)local O=C:FindFirstChild("\102\111\111")assert.equal(O.ClassName,"\077\111\100\117\108\101\083\099\114\105\112\116")assert.equal(O.Source,"-- \102\111\111\046\108\117\097")assert.equal(#Y:GetChildren(),1)local D=Y:FindFirstChild("\097\099\107")assert.equal(D.ClassName,"\077\111\100\117\108\101\083\099\114\105\112\116")assert.equal(D.Source,"-- \097\099\107\046\108\117\097")end)it("\115\104\111\117\108\100 \110\111\116 \116\111\117\099\104 \105\110\105\116\046\108\117\097 \105\102 \108\111\097\100\073\110\105\116\077\111\100\117\108\101\115 \105\115 \102\097\108\115\101",function()local Z=q.Habitat:new()local S=Z:loadFromFs("\115\112\101\099\047\116\101\115\116-\112\114\111\106\101\099\116",{loadInitModules=false})assert.equal(#S:GetChildren(),3)local B=S:FindFirstChild("\117\115\117\114\112")assert.equal(B.ClassName,"\070\111\108\100\101\114")local C=B:FindFirstChild("\105\110\105\116")assert.equal(C.ClassName,"\077\111\100\117\108\101\083\099\114\105\112\116")assert.equal(C.Source,"-- \105\110\105\116\046\108\117\097")local Y=B:FindFirstChild("\102\111\111")assert.equal(Y.ClassName,"\077\111\100\117\108\101\083\099\114\105\112\116")assert.equal(Y.Source,"-- \102\111\111\046\108\117\097")end)end)
package.path = "./?/init.lua;" .. package.path
local lemur = require("lib")

describe("Lemur", function()
	it("should load folders correctly", function()
		local habitat = lemur.Habitat:new()

		local root = habitat:loadFromFs("spec/test-project")

		assert.equal(#root:GetChildren(), 3)

		local bar = root:FindFirstChild("bar")
		local usurp = root:FindFirstChild("usurp")
		local normal = root:FindFirstChild("normal-folder")

		assert.equal(bar.ClassName, "ModuleScript")
		assert.equal(usurp.ClassName, "ModuleScript")
		assert.equal(normal.ClassName, "Folder")

		assert.equal(bar.Source, "-- bar.lua")
		assert.equal(usurp.Source, "-- init.lua")

		assert.equal(#usurp:GetChildren(), 1)

		local foo = usurp:FindFirstChild("foo")
		assert.equal(foo.ClassName, "ModuleScript")
		assert.equal(foo.Source, "-- foo.lua")

		assert.equal(#normal:GetChildren(), 1)

		local ack = normal:FindFirstChild("ack")
		assert.equal(ack.ClassName, "ModuleScript")
		assert.equal(ack.Source, "-- ack.lua")
	end)

	it("should not touch init.lua if loadInitModules is false", function()
		local habitat = lemur.Habitat:new()

		local root = habitat:loadFromFs("spec/test-project", {
			loadInitModules = false,
		})

		assert.equal(#root:GetChildren(), 3)

		local usurp = root:FindFirstChild("usurp")
		assert.equal(usurp.ClassName, "Folder")

		local init = usurp:FindFirstChild("init")
		assert.equal(init.ClassName, "ModuleScript")
		assert.equal(init.Source, "-- init.lua")

		local foo = usurp:FindFirstChild("foo")
		assert.equal(foo.ClassName, "ModuleScript")
		assert.equal(foo.Source, "-- foo.lua")
	end)
end)