local N=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 f=N.test local u=N.expect local p=require("\046\046\047\105\110\105\116")local b=p.Future f("\117\110\119\114\097\112\079\114\069\108\115\101",function()local N=b.new(function()error("\065",0)end)N=N:unwrapOrElse(function(N)(u(N)).toEqual("\065")return 1,2,3 end)local f=N:await();(u(f:isOk())).toBe(true)local p={f:unwrapOk()};(u(p)).toEqual({1,2,3})u.assertions(3)end)
local JestGlobals = require("@DevPackages/JestGlobals")

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

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

test("unwrapOrElse", function()
	local myFuture = Future.new(function()
		error("A", 0)
	end)

	myFuture = myFuture:unwrapOrElse(function(err)
		expect(err).toEqual("A")
		return 1, 2, 3
	end)

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

	local results = { result:unwrapOk() }
	expect(results).toEqual({ 1, 2, 3 })

	expect.assertions(3)
end)
