local I=script.Parent.Parent local p=I.Parent local l=require(p.Dev.Roact)local t=require(p.Dev.ReactRoblox)local o=require(p.Dev.Scheduler)local b=require(p.Dev.JestGlobals)local q=b.expect local Y=b.describe local S=b.it local X=(require(I.firstRenderBenchmark))(l,t,o)Y("\102\105\114\115\116 \114\101\110\100\101\114 \098\101\110\099\104\109\097\114\107 \116\101\115\116\115",function()if not _G.__DEV__ then S("\115\104\111\117\108\100 \114\117\110 \116\104\101 \098\101\110\099\104\109\097\114\107 \097\110\100 \114\101\116\117\114\110 \099\097\108\099\117\108\097\116\101\100 \115\116\097\116\115 \040\050 \115\097\109\112\108\101\115\041",function()local I=2 local p=X({minSamples=I;verbose=true});(q(p.min)).toBeGreaterThan(0);(q(p.min)).toBeLessThan(math.huge);(q(p.max)).toBeGreaterThan(0);(q(p.variance)).toBeGreaterThanOrEqual(0);(q(p.stdDev)).toBe(math.sqrt(p.variance));(q(p.count)).toBe(I)end)else S("\078\069\069\068\083 \065\084 \076\069\065\083\084 \079\078\069 \084\069\083\084 \073\078 \065 \083\085\073\084\069",function() end)end end)
local testWorkspace = script.Parent.Parent
local rootWorkspace = testWorkspace.Parent

local Roact = require(rootWorkspace.Dev.Roact)
local ReactRoblox = require(rootWorkspace.Dev.ReactRoblox)
local Scheduler = require(rootWorkspace.Dev.Scheduler)
local JestGlobals = require(rootWorkspace.Dev.JestGlobals)
local jestExpect = JestGlobals.expect
local describe = JestGlobals.describe
local it = JestGlobals.it

local firstRenderBenchmark = require(testWorkspace.firstRenderBenchmark)(Roact, ReactRoblox, Scheduler)

describe("first render benchmark tests", function()
	-- FIXME: This test is super noisy in dev because it doesn't use `act`,
	-- but the scheduler isn't mocked so it shouldn't need to anyways
	if not _G.__DEV__ then
		it("should run the benchmark and return calculated stats (2 samples)", function()
			local minSamples = 2
			local benchmarkStats = firstRenderBenchmark({ minSamples = minSamples, verbose = true })
			jestExpect(benchmarkStats.min).toBeGreaterThan(0)
			jestExpect(benchmarkStats.min).toBeLessThan(math.huge)
			jestExpect(benchmarkStats.max).toBeGreaterThan(0)
			jestExpect(benchmarkStats.variance).toBeGreaterThanOrEqual(0)
			jestExpect(benchmarkStats.stdDev).toBe(math.sqrt(benchmarkStats.variance))
			jestExpect(benchmarkStats.count).toBe(minSamples)
		end)
	else
		it("NEEDS AT LEAST ONE TEST IN A SUITE", function() end)
	end
end)
