local S=require(((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")):WaitForChild("\078\101\120\117\115\066\117\116\116\111\110")):WaitForChild("\083\105\109\112\108\101\087\114\097\112\112\101\100\073\110\115\116\097\110\099\101"))return function()describe("\065 \083\105\109\112\108\101\087\114\097\112\112\101\100\073\110\115\116\097\110\099\101",function()local K,O=nil,nil beforeEach(function()K=Instance.new("\070\114\097\109\101")O=S.new(K)end)afterEach(function()O:Destroy()end)it("\115\104\111\117\108\100 \104\097\118\101 \116\104\101 \119\114\097\112\112\101\100 \105\110\115\116\097\110\099\101\046",function()(expect(O:GetWrappedInstance())).to.equal(K)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \105\110\115\116\097\110\099\101 \112\114\111\112\101\114\116\105\101\115\046",function()(expect(O.BackgroundColor3)).to.equal(K.BackgroundColor3)end)it("\115\104\111\117\108\100 \112\097\115\115 \105\110\115\116\097\110\099\101 \102\117\110\099\116\105\111\110\115\046",function()local S=Instance.new("\070\114\097\109\101")S.Name="\084\101\115\116\070\114\097\109\101"S.Parent=K;(expect(O:FindFirstChild("\084\101\115\116\070\114\097\109\101"))).to.equal(S)end)it("\115\104\111\117\108\100 \114\101\112\108\105\099\097\116\101 \099\104\097\110\103\101\115 \116\111 \116\104\101 \105\110\115\116\097\110\099\101\046",function()O.Name="\084\101\115\116\070\114\097\109\101";(expect(O.Name)).to.equal("\084\101\115\116\070\114\097\109\101");(expect(K.Name)).to.equal("\084\101\115\116\070\114\097\109\101")end)it("\115\104\111\117\108\100 \110\111\116 \114\101\112\108\105\099\097\116\101 \100\105\115\097\098\108\101\100 \099\104\097\110\103\101\115 \116\111 \116\104\101 \105\110\115\116\097\110\099\101\046",function()O:DisableChangeReplication("\078\097\109\101")O.Name="\084\101\115\116\070\114\097\109\101";(expect(O.Name)).to.equal("\084\101\115\116\070\114\097\109\101");(expect(K.Name)).to.never.equal("\084\101\115\116\070\114\097\109\101")end)it("\115\104\111\117\108\100 \114\101\112\108\105\099\097\116\101 \099\104\097\110\103\101\115 \102\114\111\109 \116\104\101 \105\110\115\116\097\110\099\101\046",function()O.Name="\084\101\115\116\070\114\097\109\101\049";(expect(O.Name)).to.equal("\084\101\115\116\070\114\097\109\101\049");(expect(K.Name)).to.equal("\084\101\115\116\070\114\097\109\101\049")local S=nil local V=0 K.Changed:Connect(function(K)S=K end);(K:GetPropertyChangedSignal("\078\097\109\101")):Connect(function()V+=1 end)K.Name="\084\101\115\116\070\114\097\109\101\050"task.wait();(expect(O.Name)).to.equal("\084\101\115\116\070\114\097\109\101\050");(expect(K.Name)).to.equal("\084\101\115\116\070\114\097\109\101\050");(expect(S)).to.equal("\078\097\109\101");(expect(V)).to.equal(1)end)it("\115\104\111\117\108\100 \102\105\114\101 \099\104\097\110\103\101\115 \102\114\111\109 \116\104\101 \105\110\115\116\097\110\099\101 \116\104\097\116 \097\114\101\110\'\116 \115\116\111\114\101\100 \105\110 \116\104\101 \111\098\106\101\099\116\046",function()local S=nil local V=0 K.Changed:Connect(function(K)S=K end);(K:GetPropertyChangedSignal("\078\097\109\101")):Connect(function()V+=1 end)K.Name="\084\101\115\116\070\114\097\109\101"task.wait();(expect(O.Name)).to.equal("\084\101\115\116\070\114\097\109\101");(expect(S)).to.equal("\078\097\109\101");(expect(V)).to.equal(1)end)it("\115\104\111\117\108\100 \100\101\115\116\114\111\121 \116\104\101 \119\114\097\112\112\101\100 \105\110\115\116\097\110\099\101\046",function()local S=false K.Destroying:Connect(function()S=true end)O:Destroy()task.wait();(expect(S)).to.equal(true)end)end)end
--Tests SimpleWrappedInstance.
--!strict

local SimpleWrappedInstance = require(game:GetService("ReplicatedStorage"):WaitForChild("NexusButton"):WaitForChild("SimpleWrappedInstance"))

return function()
    describe("A SimpleWrappedInstance", function()
        local TestInstance, TestSimpleWrappedInstance = nil, nil
        beforeEach(function()
            TestInstance = Instance.new("Frame")
            TestSimpleWrappedInstance = SimpleWrappedInstance.new(TestInstance)
        end)
        afterEach(function()
            TestSimpleWrappedInstance:Destroy()
        end)

        it("should have the wrapped instance.", function()
            expect(TestSimpleWrappedInstance:GetWrappedInstance()).to.equal(TestInstance)
        end)

        it("should return instance properties.", function()
            expect(TestSimpleWrappedInstance.BackgroundColor3).to.equal(TestInstance.BackgroundColor3)
        end)

        it("should pass instance functions.", function()
            local TestFrame = Instance.new("Frame")
            TestFrame.Name = "TestFrame"
            TestFrame.Parent = TestInstance

            expect(TestSimpleWrappedInstance:FindFirstChild("TestFrame")).to.equal(TestFrame)
        end)

        it("should replicate changes to the instance.", function()
            TestSimpleWrappedInstance.Name = "TestFrame"
            expect(TestSimpleWrappedInstance.Name).to.equal("TestFrame")
            expect(TestInstance.Name).to.equal("TestFrame")
        end)

        it("should not replicate disabled changes to the instance.", function()
            TestSimpleWrappedInstance:DisableChangeReplication("Name")
            TestSimpleWrappedInstance.Name = "TestFrame"
            expect(TestSimpleWrappedInstance.Name).to.equal("TestFrame")
            expect(TestInstance.Name).to.never.equal("TestFrame")
        end)

        it("should replicate changes from the instance.", function()
            TestSimpleWrappedInstance.Name = "TestFrame1"
            expect(TestSimpleWrappedInstance.Name).to.equal("TestFrame1")
            expect(TestInstance.Name).to.equal("TestFrame1")

            local FiredPropertyName = nil
            local ChangesFired = 0
            TestInstance.Changed:Connect(function(PropertyName)
                FiredPropertyName = PropertyName
            end)
            TestInstance:GetPropertyChangedSignal("Name"):Connect(function()
                ChangesFired += 1
            end)
            TestInstance.Name = "TestFrame2"
            task.wait()
            expect(TestSimpleWrappedInstance.Name).to.equal("TestFrame2")
            expect(TestInstance.Name).to.equal("TestFrame2")
            expect(FiredPropertyName).to.equal("Name")
            expect(ChangesFired).to.equal(1)
        end)

        it("should fire changes from the instance that aren't stored in the object.", function()
            local FiredPropertyName = nil
            local ChangesFired = 0
            TestInstance.Changed:Connect(function(PropertyName)
                FiredPropertyName = PropertyName
            end)
            TestInstance:GetPropertyChangedSignal("Name"):Connect(function()
                ChangesFired += 1
            end)
            TestInstance.Name = "TestFrame"
            task.wait()
            expect(TestSimpleWrappedInstance.Name).to.equal("TestFrame")
            expect(FiredPropertyName).to.equal("Name")
            expect(ChangesFired).to.equal(1)
        end)

        it("should destroy the wrapped instance.", function()
            local Destroyed = false
            TestInstance.Destroying:Connect(function()
                Destroyed = true
            end)

            TestSimpleWrappedInstance:Destroy()
            task.wait()
            expect(Destroyed).to.equal(true)
        end)
    end)
end