local W=require("\064\068\101\118\080\097\099\107\097\103\101\115\047\074\101\115\116\071\108\111\098\097\108\115")local z=W.test local g=W.expect local Q=require("\046\046\047\105\110\105\116")local s=Q.Future z("\097\110\100\084\104\101\110",function()local W=s.new(function()return"\097","\098","\099"end)local z=W:andThen(function()return s.new(function()return 1,2,3 end)end)local Q=z:await();(g(Q:isOk())).toBe(true)local t={Q:unwrapOk()};(g(t)).toEqual({1;2;3})end)
local JestGlobals = require("@DevPackages/JestGlobals")

local test = JestGlobals.test
local expect = JestGlobals.expect

local Futures = require("../init")
local Future = Futures.Future

test("andThen", function()
	local myFuture = Future.new(function()
		return "a", "b", "c"
	end)

	local nextFuture = myFuture:andThen(function()
		return Future.new(function()
			return 1, 2, 3
		end)
	end)

	local result = nextFuture:await()
	expect(result:isOk()).toBe(true)

	local values = { result:unwrapOk() }

	expect(values).toEqual({ 1, 2, 3 })
end)
