local I=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local A=require(I.Packages.Dex.Observables.Tween)local f=require(I.Packages.Dex.Observables.State)return function()local function I()local I=os.clock()while os.clock()==I do end end it("\099\111\110\115\116\114\117\099\116\115 \097\110 \084\119\101\101\110 \111\098\115\101\114\118\097\098\108\101 \119\105\116\104 \114\101\097\099\116\105\118\101 \100\105\115\112\097\116\099\104",function()local T=f.new(0)local W=A.new(T:Map(function(I)return{goal=I;info=TweenInfo.new(1,Enum.EasingStyle.Linear)}end))local J=W:Subscribe(function() end);(expect(W)).to.be.ok();(expect(W:Current())).to.equal(0)I();(expect(W:Current())).to.equal(0)T:Set(1)I();(expect(W:Current())).to.never.equal(0)J()end)it("\099\111\110\115\116\114\117\099\116\115 \097\110 \084\119\101\101\110 \111\098\115\101\114\118\097\098\108\101 \119\105\116\104 \109\101\116\104\111\100 \100\105\115\112\097\116\099\104",function()local f=A.new(0)local T=f:Subscribe(function() end);(expect(f)).to.be.ok();(expect(f:Current())).to.equal(0)I();(expect(f:Current())).to.equal(0)f:Play({goal=1;info=TweenInfo.new(1,Enum.EasingStyle.Linear)})I();(expect(f:Current())).to.never.equal(0)T()end)end
--!strict
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Tween = require(ReplicatedStorage.Packages.Dex.Observables.Tween)
local State = require(ReplicatedStorage.Packages.Dex.Observables.State)

return function()
    local function waitUntilClockChange()
        local start = os.clock()
        -- selene: allow(empty_loop)
        while os.clock() == start do end
    end

    it("constructs an Tween observable with reactive dispatch", function()
        local target = State.new(0)
        local tween = Tween.new(target:Map(function(current)
            return {
                goal = current,
                info = TweenInfo.new(1, Enum.EasingStyle.Linear)
            }
        end))
        local unsub = tween:Subscribe(function() end)
        expect(tween).to.be.ok()
        expect(tween:Current()).to.equal(0)
        waitUntilClockChange()
        expect(tween:Current()).to.equal(0)
        target:Set(1)
        waitUntilClockChange()
        expect(tween:Current()).to.never.equal(0)
        unsub()
    end)
    it("constructs an Tween observable with method dispatch", function()
        local tween = Tween.new(0)
        local unsub = tween:Subscribe(function() end)
        expect(tween).to.be.ok()
        expect(tween:Current()).to.equal(0)
        waitUntilClockChange()
        expect(tween:Current()).to.equal(0)
        tween:Play({
            goal = 1,
            info = TweenInfo.new(1, Enum.EasingStyle.Linear)
        })
        waitUntilClockChange()
        expect(tween:Current()).to.never.equal(0)
        unsub()
    end)
end
