local P=require("\064\112\107\103\047\064\106\115\100\111\116\108\117\097\047\106\101\115\116-\103\108\111\098\097\108\115")local k=P.expect local p=P.jest local O=P.describe local V=P.beforeEach local Q=P.it local s=P.xit local x local J local U local b=nil local a={renderIntoDocument=function(P)local k=Instance.new("\070\111\108\100\101\114")local p=J.createLegacyRoot(k)p:render(P)return p end}O("\082\101\097\099\116\069\108\101\109\101\110\116\086\097\108\105\100\097\116\111\114",function()local P V(function()p.resetModules()U=(require("\064\112\107\103\047\064\106\115\100\111\116\108\117\097\047\115\104\097\114\101\100")).ReactFeatureFlags U.replayFailedUnitOfWorkWithInvokeGuardedCallback=false x=require("\046\046")J=require("\064\112\107\103\047\064\106\115\100\111\116\108\117\097\047\114\101\097\099\116-\114\111\098\108\111\120")P=x.Component:extend("\067\111\109\112\111\110\101\110\116\067\108\097\115\115")function P.render(P)return x.createElement("\070\114\097\109\101")end end)Q("\119\097\114\110\115 \102\111\114 \107\101\121\115 \102\111\114 \097\114\114\097\121\115 \111\102 \101\108\101\109\101\110\116\115 \105\110 \114\101\115\116 \097\114\103\115",function()(k(function()x.createElement(P,nil,{x.createElement(P),x.createElement(P)})end)).toErrorDev("\069\097\099\104 \099\104\105\108\100 \105\110 \097 \108\105\115\116 \115\104\111\117\108\100 \104\097\118\101 \097 \117\110\105\113\117\101 \"\107\101\121\" \112\114\111\112\046")end)Q("\119\097\114\110\115 \102\111\114 \107\101\121\115 \102\111\114 \097\114\114\097\121\115 \111\102 \101\108\101\109\101\110\116\115 \119\105\116\104 \111\119\110\101\114 \105\110\102\111",function()local p=x.Component:extend("\073\110\110\101\114\067\108\097\115\115")function p.render(k)return x.createElement(P,nil,k.props.childSet)end local O=x.Component:extend("\067\111\109\112\111\110\101\110\116\087\114\097\112\112\101\114")function O.render(k)return x.createElement(p,{childSet={x.createElement(P),x.createElement(P)}})end;(k(function()a.renderIntoDocument(x.createElement(O))end)).toErrorDev("\069\097\099\104 \099\104\105\108\100 \105\110 \097 \108\105\115\116 \115\104\111\117\108\100 \104\097\118\101 \097 \117\110\105\113\117\101 \"\107\101\121\" \112\114\111\112\046\n\n\067\104\101\099\107 \116\104\101 \114\101\110\100\101\114 \109\101\116\104\111\100 \111\102 \096\073\110\110\101\114\067\108\097\115\115\096\046 \073\116 \119\097\115 \112\097\115\115\101\100 \097 \099\104\105\108\100 \102\114\111\109 \067\111\109\112\111\110\101\110\116\087\114\097\112\112\101\114\046 ")end)Q("\119\097\114\110\115 \102\111\114 \107\101\121\115 \102\111\114 \097\114\114\097\121\115 \119\105\116\104 \110\111 \111\119\110\101\114 \111\114 \112\097\114\101\110\116 \105\110\102\111",function()local P={x.createElement("\070\114\097\109\101"),x.createElement("\070\114\097\109\101")};(k(function()a.renderIntoDocument(x.createElement(function()return x.createElement("\070\114\097\109\101")end,nil,P))end)).toErrorDev("\087\097\114\110\105\110\103\058 \069\097\099\104 \099\104\105\108\100 \105\110 \097 \108\105\115\116 \115\104\111\117\108\100 \104\097\118\101 \097 \117\110\105\113\117\101 \"\107\101\121\" \112\114\111\112\046 \083\101\101 \104\116\116\112\115\058\047\047\114\101\097\099\116\106\115\046\111\114\103\047\108\105\110\107\047\119\097\114\110\105\110\103-\107\101\121\115 \102\111\114 \109\111\114\101 \105\110\102\111\114\109\097\116\105\111\110\046\n    \105\110 \070\114\097\109\101 \040\097\116 \042\042\041")end)Q("\119\097\114\110\115 \102\111\114 \107\101\121\115 \102\111\114 \097\114\114\097\121\115 \111\102 \101\108\101\109\101\110\116\115 \119\105\116\104 \110\111 \111\119\110\101\114 \105\110\102\111",function()local P={x.createElement("\070\114\097\109\101"),x.createElement("\070\114\097\109\101")};(k(function()a.renderIntoDocument(x.createElement("\070\114\097\109\101",nil,P))end)).toErrorDev("\087\097\114\110\105\110\103\058 \069\097\099\104 \099\104\105\108\100 \105\110 \097 \108\105\115\116 \115\104\111\117\108\100 \104\097\118\101 \097 \117\110\105\113\117\101 \"\107\101\121\" \112\114\111\112\046\n\n\067\104\101\099\107 \116\104\101 \116\111\112-\108\101\118\101\108 \114\101\110\100\101\114 \099\097\108\108 \117\115\105\110\103 \060\070\114\097\109\101\062\046 \083\101\101 \104\116\116\112\115\058\047\047\114\101\097\099\116\106\115\046\111\114\103\047\108\105\110\107\047\119\097\114\110\105\110\103-\107\101\121\115 \102\111\114 \109\111\114\101 \105\110\102\111\114\109\097\116\105\111\110\046\n    \105\110 \070\114\097\109\101 \040\097\116 \042\042\041")end)Q("\119\097\114\110\115 \102\111\114 \107\101\121\115 \119\105\116\104 \099\111\109\112\111\110\101\110\116 \115\116\097\099\107 \105\110\102\111",function()local function P()return x.createElement("\070\114\097\109\101",nil,{x.createElement("\070\114\097\109\101");x.createElement("\070\114\097\109\101")})end local function p(P)return x.cloneElement(P.child)end local function O()return x.createElement(p,{child=x.createElement(P)})end;(k(function()a.renderIntoDocument(x.createElement(O))end)).toErrorDev("\087\097\114\110\105\110\103\058 \069\097\099\104 \099\104\105\108\100 \105\110 \097 \108\105\115\116 \115\104\111\117\108\100 \104\097\118\101 \097 \117\110\105\113\117\101 \"\107\101\121\" \112\114\111\112\046\n\n\067\104\101\099\107 \116\104\101 \114\101\110\100\101\114 \109\101\116\104\111\100 \111\102 \096\067\111\109\112\111\110\101\110\116\096\046 \083\101\101 \104\116\116\112\115\058\047\047\114\101\097\099\116\106\115\046\111\114\103\047\108\105\110\107\047\119\097\114\110\105\110\103-\107\101\121\115 \102\111\114 \109\111\114\101 \105\110\102\111\114\109\097\116\105\111\110\046\n    \105\110 \070\114\097\109\101 \040\097\116 \042\042\041\n    \105\110 \067\111\109\112\111\110\101\110\116 \040\097\116 \042\042\041\n    \105\110 \080\097\114\101\110\116 \040\097\116 \042\042\041\n    \105\110 \071\114\097\110\100\080\097\114\101\110\116 \040\097\116 \042\042\041")end)Q("\100\111\101\115 \110\111\116 \119\097\114\110 \102\111\114 \107\101\121\115 \119\104\101\110 \112\097\115\115\105\110\103 \099\104\105\108\100\114\101\110 \100\111\119\110",function()local function P(P)return x.createElement("\070\114\097\109\101",nil,P.children,x.createElement("\070\114\097\109\101"))end;(k(function()a.renderIntoDocument(x.createElement(P,nil,x.createElement("\070\114\097\109\101"),x.createElement("\070\114\097\109\101")))end)).toErrorDev({})end)Q("\100\111\101\115 \110\111\116 \119\097\114\110 \102\111\114 \107\101\121\115 \119\104\101\110 \112\114\111\118\105\100\105\110\103 \107\101\121\115 \118\105\097 \099\104\105\108\100\114\101\110 \116\097\098\108\101\115",function()(k(function()a.renderIntoDocument(x.createElement("\070\114\097\109\101",nil,{ChildA=x.createElement("\070\114\097\109\101");ChildB=x.createElement("\070\114\097\109\101")}))end)).toErrorDev({})end)s("\119\097\114\110\115 \102\111\114 \107\101\121\115 \102\111\114 \105\116\101\114\097\098\108\101\115 \111\102 \101\108\101\109\101\110\116\115 \105\110 \114\101\115\116 \097\114\103\115",function()local p={["\064\064\105\116\101\114\097\116\111\114"]=function()local k=0 return{next=function()k=k+1 local p=k>2 local O if not p then O=x.createElement(P)end return{value=O;done=p}end}end};(k(function()return x.createElement(P,nil,p)end)).toErrorDev("\069\097\099\104 \099\104\105\108\100 \105\110 \097 \108\105\115\116 \115\104\111\117\108\100 \104\097\118\101 \097 \117\110\105\113\117\101 \"\107\101\121\" \112\114\111\112\046")end)Q("\100\111\101\115 \110\111\116 \119\097\114\110\115 \102\111\114 \097\114\114\097\121\115 \111\102 \101\108\101\109\101\110\116\115 \119\105\116\104 \107\101\121\115",function()x.createElement(P,nil,{x.createElement(P,{key="\035\049"}),x.createElement(P,{key="\035\050"})})end)s("\100\111\101\115 \110\111\116 \119\097\114\110\115 \102\111\114 \105\116\101\114\097\098\108\101 \101\108\101\109\101\110\116\115 \119\105\116\104 \107\101\121\115",function()local k={["\064\064\105\116\101\114\097\116\111\114"]=function()local k=0 return{next=function()k=k+1 local p=k>2 return{value=not p and x.createElement(P,{key="\035"..k})or nil;done=p}end}end}x.createElement(P,nil,k)end)Q("\100\111\101\115 \110\111\116 \119\097\114\110 \119\104\101\110 \116\104\101 \101\108\101\109\101\110\116 \105\115 \100\105\114\101\099\116\108\121 \105\110 \114\101\115\116 \097\114\103\115",function()x.createElement(P,nil,x.createElement(P),x.createElement(P))end)Q("\100\111\101\115 \110\111\116 \119\097\114\110 \119\104\101\110 \116\104\101 \097\114\114\097\121 \099\111\110\116\097\105\110\115 \097 \110\111\110-\101\108\101\109\101\110\116",function()x.createElement(P,nil,{{},{}})end)s("\115\104\111\117\108\100 \103\105\118\101 \099\111\110\116\101\120\116 \102\111\114 \080\114\111\112\084\121\112\101 \101\114\114\111\114\115 \105\110 \110\101\115\116\101\100 \099\111\109\112\111\110\101\110\116\115\046",function()local P=x.Component:extend("\077\121\067\111\109\112")function P.render(P)return x.createElement("\070\114\097\109\101",nil,"\077\121 \099\111\108\111\114 \105\115 "..P.props.color)end P.propTypes={color=b.string}local function p()return x.createElement(P,{color=123})end;(k(function()a.renderIntoDocument(x.createElement(p))end)).toErrorDev("\087\097\114\110\105\110\103\058 \070\097\105\108\101\100 \112\114\111\112 \116\121\112\101\058 \073\110\118\097\108\105\100 \112\114\111\112 \096\099\111\108\111\114\096 \111\102 \116\121\112\101 \096\110\117\109\098\101\114\096 \115\117\112\112\108\105\101\100 \116\111 \096\077\121\067\111\109\112\096\044 \101\120\112\101\099\116\101\100 \096\115\116\114\105\110\103\096\046\n    \105\110 \077\121\067\111\109\112 \040\097\116 \042\042\041\n    \105\110 \080\097\114\101\110\116\067\111\109\112 \040\097\116 \042\042\041")end)Q("\103\105\118\101\115 \097 \104\101\108\112\102\117\108 \101\114\114\111\114 \119\104\101\110 \112\097\115\115\105\110\103 \105\110\118\097\108\105\100 \116\121\112\101\115",function()local function P() end;(k(function()x.createElement(nil)x.createElement(true)x.createElement({x=17})x.createElement({})x.createElement(x.createElement("\070\114\097\109\101"))x.createElement(x.createElement(P))x.createElement(x.createElement((x.createContext()).Consumer))x.createElement({["\036\036\116\121\112\101\111\102"]="\110\111\110-\114\101\097\099\116-\116\104\105\110\103"})end)).toErrorDev({"\087\097\114\110\105\110\103\058 \082\101\097\099\116\046\099\114\101\097\116\101\069\108\101\109\101\110\116\058 \116\121\112\101 \105\115 \105\110\118\097\108\105\100 -- \101\120\112\101\099\116\101\100 \097 \115\116\114\105\110\103 \040\102\111\114 \098\117\105\108\116-\105\110 \099\111\109\112\111\110\101\110\116\115\041 \111\114 \097 \099\108\097\115\115\047\102\117\110\099\116\105\111\110 \040\102\111\114 \099\111\109\112\111\115\105\116\101 \099\111\109\112\111\110\101\110\116\115\041 \098\117\116 \103\111\116\058 \110\105\108\046","\087\097\114\110\105\110\103\058 \082\101\097\099\116\046\099\114\101\097\116\101\069\108\101\109\101\110\116\058 \116\121\112\101 \105\115 \105\110\118\097\108\105\100 -- \101\120\112\101\099\116\101\100 \097 \115\116\114\105\110\103 \040\102\111\114 \098\117\105\108\116-\105\110 \099\111\109\112\111\110\101\110\116\115\041 \111\114 \097 \099\108\097\115\115\047\102\117\110\099\116\105\111\110 \040\102\111\114 \099\111\109\112\111\115\105\116\101 \099\111\109\112\111\110\101\110\116\115\041 \098\117\116 \103\111\116\058 \098\111\111\108\101\097\110\046";"\087\097\114\110\105\110\103\058 \082\101\097\099\116\046\099\114\101\097\116\101\069\108\101\109\101\110\116\058 \116\121\112\101 \105\115 \105\110\118\097\108\105\100 -- \101\120\112\101\099\116\101\100 \097 \115\116\114\105\110\103 \040\102\111\114 \098\117\105\108\116-\105\110 \099\111\109\112\111\110\101\110\116\115\041 \111\114 \097 \099\108\097\115\115\047\102\117\110\099\116\105\111\110 \040\102\111\114 \099\111\109\112\111\115\105\116\101 \099\111\109\112\111\110\101\110\116\115\041 \098\117\116 \103\111\116\058 \116\097\098\108\101\046","\087\097\114\110\105\110\103\058 \082\101\097\099\116\046\099\114\101\097\116\101\069\108\101\109\101\110\116\058 \116\121\112\101 \105\115 \105\110\118\097\108\105\100 -- \101\120\112\101\099\116\101\100 \097 \115\116\114\105\110\103 \040\102\111\114 \098\117\105\108\116-\105\110 \099\111\109\112\111\110\101\110\116\115\041 \111\114 \097 \099\108\097\115\115\047\102\117\110\099\116\105\111\110 \040\102\111\114 \099\111\109\112\111\115\105\116\101 \099\111\109\112\111\110\101\110\116\115\041 \098\117\116 \103\111\116\058 \097\114\114\097\121\046 \089\111\117 \108\105\107\101\108\121 \102\111\114\103\111\116 \116\111 \101\120\112\111\114\116 \121\111\117\114 \099\111\109\112\111\110\101\110\116 \102\114\111\109 \116\104\101 \102\105\108\101 \105\116\'\115 \100\101\102\105\110\101\100 \105\110\044 \111\114 \121\111\117 \109\105\103\104\116 \104\097\118\101 \109\105\120\101\100 \117\112 \100\101\102\097\117\108\116 \097\110\100 \110\097\109\101\100 \105\109\112\111\114\116\115\046";"\087\097\114\110\105\110\103\058 \082\101\097\099\116\046\099\114\101\097\116\101\069\108\101\109\101\110\116\058 \116\121\112\101 \105\115 \105\110\118\097\108\105\100 -- \101\120\112\101\099\116\101\100 \097 \115\116\114\105\110\103 \040\102\111\114 \098\117\105\108\116-\105\110 \099\111\109\112\111\110\101\110\116\115\041 \111\114 \097 \099\108\097\115\115\047\102\117\110\099\116\105\111\110 \040\102\111\114 \099\111\109\112\111\115\105\116\101 \099\111\109\112\111\110\101\110\116\115\041 \098\117\116 \103\111\116\058 \060\070\114\097\109\101 \047\062\046 \068\105\100 \121\111\117 \097\099\099\105\100\101\110\116\097\108\108\121 \101\120\112\111\114\116 \097 \074\083\088 \108\105\116\101\114\097\108 \111\114 \069\108\101\109\101\110\116 \105\110\115\116\101\097\100 \111\102 \097 \099\111\109\112\111\110\101\110\116\063";"\087\097\114\110\105\110\103\058 \082\101\097\099\116\046\099\114\101\097\116\101\069\108\101\109\101\110\116\058 \116\121\112\101 \105\115 \105\110\118\097\108\105\100 -- \101\120\112\101\099\116\101\100 \097 \115\116\114\105\110\103 \040\102\111\114 \098\117\105\108\116-\105\110 \099\111\109\112\111\110\101\110\116\115\041 \111\114 \097 \099\108\097\115\115\047\102\117\110\099\116\105\111\110 \040\102\111\114 \099\111\109\112\111\115\105\116\101 \099\111\109\112\111\110\101\110\116\115\041 \098\117\116 \103\111\116\058 \060\070\111\111 \047\062\046 \068\105\100 \121\111\117 \097\099\099\105\100\101\110\116\097\108\108\121 \101\120\112\111\114\116 \097 \074\083\088 \108\105\116\101\114\097\108 \111\114 \069\108\101\109\101\110\116 \105\110\115\116\101\097\100 \111\102 \097 \099\111\109\112\111\110\101\110\116\063";"\087\097\114\110\105\110\103\058 \082\101\097\099\116\046\099\114\101\097\116\101\069\108\101\109\101\110\116\058 \116\121\112\101 \105\115 \105\110\118\097\108\105\100 -- \101\120\112\101\099\116\101\100 \097 \115\116\114\105\110\103 \040\102\111\114 \098\117\105\108\116-\105\110 \099\111\109\112\111\110\101\110\116\115\041 \111\114 \097 \099\108\097\115\115\047\102\117\110\099\116\105\111\110 \040\102\111\114 \099\111\109\112\111\115\105\116\101 \099\111\109\112\111\110\101\110\116\115\041 \098\117\116 \103\111\116\058 \060\067\111\110\116\101\120\116\046\067\111\110\115\117\109\101\114 \047\062\046 \068\105\100 \121\111\117 \097\099\099\105\100\101\110\116\097\108\108\121 \101\120\112\111\114\116 \097 \074\083\088 \108\105\116\101\114\097\108 \111\114 \069\108\101\109\101\110\116 \105\110\115\116\101\097\100 \111\102 \097 \099\111\109\112\111\110\101\110\116\063","\087\097\114\110\105\110\103\058 \082\101\097\099\116\046\099\114\101\097\116\101\069\108\101\109\101\110\116\058 \116\121\112\101 \105\115 \105\110\118\097\108\105\100 -- \101\120\112\101\099\116\101\100 \097 \115\116\114\105\110\103 \040\102\111\114 \098\117\105\108\116-\105\110 \099\111\109\112\111\110\101\110\116\115\041 \111\114 \097 \099\108\097\115\115\047\102\117\110\099\116\105\111\110 \040\102\111\114 \099\111\109\112\111\115\105\116\101 \099\111\109\112\111\110\101\110\116\115\041 \098\117\116 \103\111\116\058 \116\097\098\108\101\046\n\123"},{withoutStack=true})x.createElement("\070\114\097\109\101")end)Q("\105\110\099\108\117\100\101\115 \116\104\101 \111\119\110\101\114 \110\097\109\101 \119\104\101\110 \112\097\115\115\105\110\103 \110\117\108\108\044 \117\110\100\101\102\105\110\101\100\044 \098\111\111\108\101\097\110\044 \111\114 \110\117\109\098\101\114",function()local function P()return x.createElement(1)end;(k(function()(k(function()a.renderIntoDocument(x.createElement(P))end)).toThrowError("\069\108\101\109\101\110\116 \116\121\112\101 \105\115 \105\110\118\097\108\105\100\058 \101\120\112\101\099\116\101\100 \097 \115\116\114\105\110\103 \040\102\111\114 \098\117\105\108\116-\105\110 \099\111\109\112\111\110\101\110\116\115\041 "..("\111\114 \097 \099\108\097\115\115\047\102\117\110\099\116\105\111\110 \040\102\111\114 \099\111\109\112\111\115\105\116\101 \099\111\109\112\111\110\101\110\116\115\041 \098\117\116 \103\111\116\058 \110\117\109\098\101\114\046"..(_G.__DEV__ and"\n\n\067\104\101\099\107 \116\104\101 \114\101\110\100\101\114 \109\101\116\104\111\100 \111\102 \096\080\097\114\101\110\116\067\111\109\112\096\046"or"")))end)).toErrorDev("\087\097\114\110\105\110\103\058 \082\101\097\099\116\046\099\114\101\097\116\101\069\108\101\109\101\110\116\058 \116\121\112\101 \105\115 \105\110\118\097\108\105\100 -- \101\120\112\101\099\116\101\100 \097 \115\116\114\105\110\103 \040\102\111\114 \098\117\105\108\116-\105\110 \099\111\109\112\111\110\101\110\116\115\041 \111\114 \097 \099\108\097\115\115\047\102\117\110\099\116\105\111\110 \040\102\111\114 \099\111\109\112\111\115\105\116\101 \099\111\109\112\111\110\101\110\116\115\041 \098\117\116 \103\111\116\058 \110\117\109\098\101\114\046")end)Q("\105\110\099\108\117\100\101\115 \116\104\101 \111\119\110\101\114 \110\097\109\101 \111\102 \097 \080\117\114\101\067\111\109\112\111\110\101\110\116",function()local P=x.PureComponent:extend("\080\097\114\101\110\116\080\117\114\101\067\111\109\112")function P.render(P)return x.createElement(1)end;(k(function()(k(function()a.renderIntoDocument(x.createElement(P))end)).toThrowError("\069\108\101\109\101\110\116 \116\121\112\101 \105\115 \105\110\118\097\108\105\100\058 \101\120\112\101\099\116\101\100 \097 \115\116\114\105\110\103 \040\102\111\114 \098\117\105\108\116-\105\110 \099\111\109\112\111\110\101\110\116\115\041 "..("\111\114 \097 \099\108\097\115\115\047\102\117\110\099\116\105\111\110 \040\102\111\114 \099\111\109\112\111\115\105\116\101 \099\111\109\112\111\110\101\110\116\115\041 \098\117\116 \103\111\116\058 \110\117\109\098\101\114\046"..(_G.__DEV__ and"\n\n\067\104\101\099\107 \116\104\101 \114\101\110\100\101\114 \109\101\116\104\111\100 \111\102 \096\080\097\114\101\110\116\080\117\114\101\067\111\109\112\096\046"or"")))end)).toErrorDev("\087\097\114\110\105\110\103\058 \082\101\097\099\116\046\099\114\101\097\116\101\069\108\101\109\101\110\116\058 \116\121\112\101 \105\115 \105\110\118\097\108\105\100 -- \101\120\112\101\099\116\101\100 \097 \115\116\114\105\110\103 \040\102\111\114 \098\117\105\108\116-\105\110 \099\111\109\112\111\110\101\110\116\115\041 \111\114 \097 \099\108\097\115\115\047\102\117\110\099\116\105\111\110 \040\102\111\114 \099\111\109\112\111\115\105\116\101 \099\111\109\112\111\110\101\110\116\115\041 \098\117\116 \103\111\116\058 \110\117\109\098\101\114\046")end)Q.skip("\115\104\111\117\108\100 \099\104\101\099\107 \100\101\102\097\117\108\116 \112\114\111\112 \118\097\108\117\101\115",function()local P=x.Component:extend("\067\111\109\112\111\110\101\110\116")function P.render(P)return x.createElement("\070\114\097\109\101",nil,P.props.prop)end P.propTypes={prop=b.string.isRequired}P.defaultProps={prop=nil};(k(function()return a.renderIntoDocument(x.createElement(P))end)).toErrorDev("\087\097\114\110\105\110\103\058 \070\097\105\108\101\100 \112\114\111\112 \116\121\112\101\058 \084\104\101 \112\114\111\112 \096\112\114\111\112\096 \105\115 \109\097\114\107\101\100 \097\115 \114\101\113\117\105\114\101\100 \105\110 \096\067\111\109\112\111\110\101\110\116\096\044 \098\117\116 \105\116\115 \118\097\108\117\101 \105\115 \096\110\117\108\108\096\046\n    \105\110 \067\111\109\112\111\110\101\110\116")end)Q.skip("\115\104\111\117\108\100 \110\111\116 \099\104\101\099\107 \116\104\101 \100\101\102\097\117\108\116 \102\111\114 \101\120\112\108\105\099\105\116 \110\117\108\108",function()local P=x.Component:extend("\067\111\109\112\111\110\101\110\116")function P.render(P)return x.createElement("\070\114\097\109\101",nil,P.props.prop)end P.propTypes={prop=b.string.isRequired}P.defaultProps={prop="\116\101\120\116"};(k(function()a.renderIntoDocument(x.createElement(P,{prop=nil}))end)).toErrorDev("\087\097\114\110\105\110\103\058 \070\097\105\108\101\100 \112\114\111\112 \116\121\112\101\058 \084\104\101 \112\114\111\112 \096\112\114\111\112\096 \105\115 \109\097\114\107\101\100 \097\115 \114\101\113\117\105\114\101\100 \105\110 \096\067\111\109\112\111\110\101\110\116\096\044 \098\117\116 \105\116\115 \118\097\108\117\101 \105\115 \096\110\117\108\108\096\046\n    \105\110 \067\111\109\112\111\110\101\110\116")end)Q.skip("\115\104\111\117\108\100 \099\104\101\099\107 \100\101\099\108\097\114\101\100 \112\114\111\112 \116\121\112\101\115",function()local P=x.Component:extend("\067\111\109\112\111\110\101\110\116")function P.render(P)return x.createElement("\070\114\097\109\101",nil,P.props.prop)end P.propTypes={prop=b.string.isRequired};(k(function()a.renderIntoDocument(x.createElement(P))a.renderIntoDocument(x.createElement(P,{prop=42}))end)).toErrorDev({"\087\097\114\110\105\110\103\058 \070\097\105\108\101\100 \112\114\111\112 \116\121\112\101\058 \084\104\101 \112\114\111\112 \096\112\114\111\112\096 \105\115 \109\097\114\107\101\100 \097\115 \114\101\113\117\105\114\101\100 \105\110 \096\067\111\109\112\111\110\101\110\116\096\044 \098\117\116 \105\116\115 \118\097\108\117\101 \105\115 \096\117\110\100\101\102\105\110\101\100\096\046\n    \105\110 \067\111\109\112\111\110\101\110\116","\087\097\114\110\105\110\103\058 \070\097\105\108\101\100 \112\114\111\112 \116\121\112\101\058 \073\110\118\097\108\105\100 \112\114\111\112 \096\112\114\111\112\096 \111\102 \116\121\112\101 \096\110\117\109\098\101\114\096 \115\117\112\112\108\105\101\100 \116\111 \096\067\111\109\112\111\110\101\110\116\096\044 \101\120\112\101\099\116\101\100 \096\115\116\114\105\110\103\096\046\n    \105\110 \067\111\109\112\111\110\101\110\116"})a.renderIntoDocument(x.createElement(P,{prop="\115\116\114\105\110\103"}))end)Q.skip("\115\104\111\117\108\100 \119\097\114\110 \105\102 \097 \080\114\111\112\084\121\112\101 \099\114\101\097\116\111\114 \105\115 \117\115\101\100 \097\115 \097 \080\114\111\112\084\121\112\101",function()local P=x.Component:extend("\067\111\109\112\111\110\101\110\116")function P.render(P)return x.createElement("\070\114\097\109\101",nil,P.props.myProp.value)end P.propTypes={myProp=b.shape};(k(function()a.renderIntoDocument(x.createElement(P,{myProp={value="\104\105"}}))end)).toErrorDev("\087\097\114\110\105\110\103\058 \067\111\109\112\111\110\101\110\116\058 \116\121\112\101 \115\112\101\099\105\102\105\099\097\116\105\111\110 \111\102 \112\114\111\112 \096\109\121\080\114\111\112\096 \105\115 \105\110\118\097\108\105\100\059 \116\104\101 \116\121\112\101 \099\104\101\099\107\101\114 \102\117\110\099\116\105\111\110 \109\117\115\116 \114\101\116\117\114\110 \096\110\117\108\108\096 \111\114 \097\110 \096\069\114\114\111\114\096 \098\117\116 \114\101\116\117\114\110\101\100 \097 \102\117\110\099\116\105\111\110\046 \089\111\117 \109\097\121 \104\097\118\101 \102\111\114\103\111\116\116\101\110 \116\111 \112\097\115\115 \097\110 \097\114\103\117\109\101\110\116 \116\111 \116\104\101 \116\121\112\101 \099\104\101\099\107\101\114 \099\114\101\097\116\111\114 \040\097\114\114\097\121\079\102\044 \105\110\115\116\097\110\099\101\079\102\044 \111\098\106\101\099\116\079\102\044 \111\110\101\079\102\044 \111\110\101\079\102\084\121\112\101\044 \097\110\100 \115\104\097\112\101 \097\108\108 \114\101\113\117\105\114\101 \097\110 \097\114\103\117\109\101\110\116\041\046")end)Q.skip("\115\104\111\117\108\100 \119\097\114\110 \105\102 \099\111\109\112\111\110\101\110\116 \100\101\099\108\097\114\101\115 \080\114\111\112\084\121\112\101\115 \105\110\115\116\101\097\100 \111\102 \112\114\111\112\084\121\112\101\115",function()local P=x.Component:extend("\077\105\115\115\112\101\108\108\101\100\080\114\111\112\084\121\112\101\115\067\111\109\112\111\110\101\110\116")function P.render(P)return x.createElement("\070\114\097\109\101",nil,P.props.prop)end P.PropTypes={prop=b.string};(k(function()a.renderIntoDocument(x.createElement(P,{prop="\072\105"}))end)).toErrorDev("\087\097\114\110\105\110\103\058 \067\111\109\112\111\110\101\110\116 \077\105\115\115\112\101\108\108\101\100\080\114\111\112\084\121\112\101\115\067\111\109\112\111\110\101\110\116 \100\101\099\108\097\114\101\100 \096\080\114\111\112\084\121\112\101\115\096 \105\110\115\116\101\097\100 \111\102 \096\112\114\111\112\084\121\112\101\115\096\046 \068\105\100 \121\111\117 \109\105\115\115\112\101\108\108 \116\104\101 \112\114\111\112\101\114\116\121 \097\115\115\105\103\110\109\101\110\116\063",{withoutStack=true})end)Q("\119\097\114\110\115 \102\111\114 \102\114\097\103\109\101\110\116\115 \119\105\116\104 \105\108\108\101\103\097\108 \097\116\116\114\105\098\117\116\101\115",function()local P=x.Component:extend("\070\111\111")function P.render(P)return x.createElement(x.Fragment,{a=1},x.createElement("\070\114\097\109\101"))end;(k(function()a.renderIntoDocument(x.createElement(P))end)).toErrorDev("\073\110\118\097\108\105\100 \112\114\111\112 \096\097\096 \115\117\112\112\108\105\101\100 \116\111 \096\082\101\097\099\116\046\070\114\097\103\109\101\110\116\096\046 \082\101\097\099\116\046\070\114\097\103\109\101\110\116 \099\097\110 \111\110\108\121 \104\097\118\101 \096\107\101\121\096 \097\110\100 \096\099\104\105\108\100\114\101\110\096 \112\114\111\112\115\046")end)if not _G.__EXPERIMENTAL__ then Q.skip("\115\104\111\117\108\100 \119\097\114\110 \119\104\101\110 \097\099\099\101\115\115\105\110\103 \046\116\121\112\101 \111\110 \097\110 \101\108\101\109\101\110\116 \102\097\099\116\111\114\121",function()local function P()return x.createElement("\070\114\097\109\101")end local p;(k(function()p=x.createFactory(P)end)).toWarnDev("\087\097\114\110\105\110\103\058 \082\101\097\099\116\046\099\114\101\097\116\101\070\097\099\116\111\114\121\040\041 \105\115 \100\101\112\114\101\099\097\116\101\100 \097\110\100 \119\105\108\108 \098\101 \114\101\109\111\118\101\100 \105\110 \097 \102\117\116\117\114\101 \109\097\106\111\114 \114\101\108\101\097\115\101\046 \067\111\110\115\105\100\101\114 \117\115\105\110\103 \074\083\088 \111\114 \117\115\101 \082\101\097\099\116\046\099\114\101\097\116\101\069\108\101\109\101\110\116\040\041 \100\105\114\101\099\116\108\121 \105\110\115\116\101\097\100\046",{withoutStack=true});(k(function()return p.type end)).toWarnDev("\087\097\114\110\105\110\103\058 \070\097\099\116\111\114\121\046\116\121\112\101 \105\115 \100\101\112\114\101\099\097\116\101\100\046 \065\099\099\101\115\115 \116\104\101 \099\108\097\115\115 \100\105\114\101\099\116\108\121 \098\101\102\111\114\101 \112\097\115\115\105\110\103 \105\116 \116\111 \099\114\101\097\116\101\070\097\099\116\111\114\121\046",{withoutStack=true});(k(p.type)).toBe(P)end)end Q.skip("\100\111\101\115 \110\111\116 \119\097\114\110 \119\104\101\110 \117\115\105\110\103 \068\079\077 \110\111\100\101 \097\115 \099\104\105\108\100\114\101\110",function() end)Q.skip("\115\104\111\117\108\100 \110\111\116 \101\110\117\109\101\114\097\116\101 \101\110\117\109\101\114\097\098\108\101 \110\117\109\098\101\114\115 \040\035\052\055\055\054\041",function() end)Q("\100\111\101\115 \110\111\116 \098\108\111\119 \117\112 \119\105\116\104 \105\110\108\105\110\101\100 \099\104\105\108\100\114\101\110",function()local P={["\036\036\116\121\112\101\111\102"]=(x.createElement("\070\114\097\109\101"))["\036\036\116\121\112\101\111\102"],type="\070\114\097\109\101",key=nil,ref=nil;props={},_owner=nil}x.createElement("\070\114\097\109\101",nil,{P})end)Q("\100\111\101\115 \110\111\116 \098\108\111\119 \117\112 \111\110 \107\101\121 \119\097\114\110\105\110\103 \119\105\116\104 \117\110\100\101\102\105\110\101\100 \116\121\112\101",function()local P=nil;(k(function()x.createElement(P,{__source={fileName="\102\105\108\101\078\097\109\101\046\108\117\097",lineNumber=100}},{x.createElement("\070\114\097\109\101")})end)).toErrorDev("\087\097\114\110\105\110\103\058 \082\101\097\099\116\046\099\114\101\097\116\101\069\108\101\109\101\110\116\058 \116\121\112\101 \105\115 \105\110\118\097\108\105\100 -- \101\120\112\101\099\116\101\100 \097 \115\116\114\105\110\103 \040\102\111\114 \098\117\105\108\116-\105\110 \099\111\109\112\111\110\101\110\116\115\041 \111\114 \097 \099\108\097\115\115\047\102\117\110\099\116\105\111\110 \040\102\111\114 \099\111\109\112\111\115\105\116\101 \099\111\109\112\111\110\101\110\116\115\041 \098\117\116 \103\111\116\058 \110\105\108\046 \089\111\117 \108\105\107\101\108\121 \102\111\114\103\111\116 \116\111 \101\120\112\111\114\116 \121\111\117\114 \099\111\109\112\111\110\101\110\116 \102\114\111\109 \116\104\101 \102\105\108\101 \105\116\'\115 \100\101\102\105\110\101\100 \105\110\044 \111\114 \121\111\117 \109\105\103\104\116 \104\097\118\101 \109\105\120\101\100 \117\112 \100\101\102\097\117\108\116 \097\110\100 \110\097\109\101\100 \105\109\112\111\114\116\115\046\n\n\067\104\101\099\107 \121\111\117\114 \099\111\100\101 \097\116 \042\042\046",{withoutStack=true})end)Q("\100\111\101\115 \110\111\116 \099\097\108\108 \108\097\122\121 \105\110\105\116\105\097\108\105\122\101\114\115 \101\097\103\101\114\108\121",function()local P=false local p=x.lazy(function()P=true return{andThen=function() end}end)x.createElement(p);(k(P)).toBe(false)end)Q("\119\097\114\110\115 \119\104\101\110 \107\101\121\115 \097\114\101 \112\114\111\118\105\100\101\100 \118\105\097 \098\111\116\104 \116\104\101 \'\107\101\121\' \112\114\111\112 \065\078\068 \116\097\098\108\101 \107\101\121\115",function()local P=x.Component:extend("\067\111\109\112\111\110\101\110\116")function P.render(P)return x.createElement("\070\114\097\109\101",nil,{a1=x.createElement("\070\114\097\109\101",{key="\097\050"}),b=x.createElement("\070\114\097\109\101",{key="\098"})})end;(k(function()a.renderIntoDocument(x.createElement(P))end)).toErrorDev("\067\104\105\108\100 \101\108\101\109\101\110\116 \114\101\099\101\105\118\101\100 \097 \"\107\101\121\" \112\114\111\112 \040\"\097\050\"\041 \105\110 \097\100\100\105\116\105\111\110 \116\111 \097 \107\101\121 \105\110 \116\104\101 \"\099\104\105\108\100\114\101\110\" \116\097\098\108\101 \111\102 \105\116\115 \112\097\114\101\110\116 \040\"\097\049\"\041\046 \080\108\101\097\115\101 \112\114\111\118\105\100\101 \111\110\108\121 \111\110\101 \107\101\121 \100\101\102\105\110\105\116\105\111\110\046 \087\104\101\110 \098\111\116\104 \097\114\101 \112\114\101\115\101\110\116\044 \116\104\101 \"\107\101\121\" \112\114\111\112 \119\105\108\108 \116\097\107\101 \112\114\101\099\101\100\101\110\099\101\046\n\n\067\104\101\099\107 \116\104\101 \114\101\110\100\101\114 \109\101\116\104\111\100 \111\102 \096\067\111\109\112\111\110\101\110\116\096\046 \083\101\101 \104\116\116\112\115\058\047\047\114\101\097\099\116\106\115\046\111\114\103\047\108\105\110\107\047\119\097\114\110\105\110\103-\107\101\121\115 \102\111\114 \109\111\114\101 \105\110\102\111\114\109\097\116\105\111\110\046\n    \105\110 \070\114\097\109\101 \040\097\116 \042\042\041\n    \105\110 \067\111\109\112\111\110\101\110\116 \040\097\116 \042\042\041")end)end)
--[[*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @emails react-core
]]
local JestGlobals = require("@pkg/@jsdotlua/jest-globals")
local jestExpect = JestGlobals.expect
local jest = JestGlobals.jest
local describe = JestGlobals.describe
local beforeEach = JestGlobals.beforeEach
local it = JestGlobals.it
local xit = JestGlobals.xit

local React
local ReactRoblox
local ReactFeatureFlags
-- ROBLOX deviation: the tests using these are currently SKIPped
local PropTypes = nil
-- ROBLOX deviation: This function is a misnomer even in upstream; here, we
-- just render it into an orphaned root
local ReactTestUtils = {
	renderIntoDocument = function(element)
		local instance = Instance.new("Folder")
		local root = ReactRoblox.createLegacyRoot(instance)
		root:render(element)
		return root
	end,
}

describe("ReactElementValidator", function()
	local ComponentClass

	beforeEach(function()
		jest.resetModules()

		-- PropTypes = require("prop-types")
		ReactFeatureFlags = require("@pkg/@jsdotlua/shared").ReactFeatureFlags
		ReactFeatureFlags.replayFailedUnitOfWorkWithInvokeGuardedCallback = false
		React = require("..")
		ReactRoblox = require("@pkg/@jsdotlua/react-roblox")
		-- ReactTestUtils = require("react-dom/test-utils")
		ComponentClass = React.Component:extend("ComponentClass")
		function ComponentClass:render()
			return React.createElement("Frame")
		end
	end)

	it("warns for keys for arrays of elements in rest args", function()
		jestExpect(function()
			React.createElement(ComponentClass, nil, {
				React.createElement(ComponentClass),
				React.createElement(ComponentClass),
			})
		end).toErrorDev('Each child in a list should have a unique "key" prop.')
	end)

	it("warns for keys for arrays of elements with owner info", function()
		local InnerClass = React.Component:extend("InnerClass")
		function InnerClass:render()
			return React.createElement(ComponentClass, nil, self.props.childSet)
		end

		local ComponentWrapper = React.Component:extend("ComponentWrapper")
		function ComponentWrapper:render()
			return React.createElement(InnerClass, {
				childSet = {
					React.createElement(ComponentClass),
					React.createElement(ComponentClass),
				},
			})
		end

		jestExpect(function()
			ReactTestUtils.renderIntoDocument(React.createElement(ComponentWrapper))
		end).toErrorDev(
			'Each child in a list should have a unique "key" prop.'
				.. "\n\nCheck the render method of `InnerClass`. "
				.. "It was passed a child from ComponentWrapper. "
		)
	end)

	it("warns for keys for arrays with no owner or parent info", function()
		-- ROBLOX deviation: we can't nil out the function's name, so use a real anonymous function
		-- local function Anonymous()
		-- 	return React.createElement("Frame")
		-- end
		-- Object.defineProperty(Anonymous, "name", {value = nil})

		local divs = {
			React.createElement("Frame"),
			React.createElement("Frame"),
		}

		jestExpect(function()
			ReactTestUtils.renderIntoDocument(React.createElement(function()
				return React.createElement("Frame")
			end, nil, divs))
		end).toErrorDev(
			"Warning: Each child in a list should have a unique "
				.. '"key" prop. See https://reactjs.org/link/warning-keys for more information.\n'
				.. "    in Frame (at **)"
		)
	end)

	it("warns for keys for arrays of elements with no owner info", function()
		local divs = {
			React.createElement("Frame"),
			React.createElement("Frame"),
		}

		jestExpect(function()
			ReactTestUtils.renderIntoDocument(React.createElement("Frame", nil, divs))
		end).toErrorDev(
			"Warning: Each child in a list should have a unique "
				.. '"key" prop.\n\nCheck the top-level render call using <Frame>. See '
				.. "https://reactjs.org/link/warning-keys for more information.\n"
				.. "    in Frame (at **)"
		)
	end)

	it("warns for keys with component stack info", function()
		local function Component()
			return React.createElement("Frame", nil, {
				React.createElement("Frame"),
				React.createElement("Frame"),
			})
		end
		local function Parent(props)
			return React.cloneElement(props.child)
		end
		local function GrandParent()
			return React.createElement(Parent, {
				child = React.createElement(Component),
			})
		end

		jestExpect(function()
			ReactTestUtils.renderIntoDocument(React.createElement(GrandParent))
		end).toErrorDev(
			"Warning: Each child in a list should have a unique "
				.. '"key" prop.\n\nCheck the render method of `Component`. See '
				.. "https://reactjs.org/link/warning-keys for more information.\n"
				.. "    in Frame (at **)\n"
				.. "    in Component (at **)\n"
				.. "    in Parent (at **)\n"
				.. "    in GrandParent (at **)"
		)
	end)

	it("does not warn for keys when passing children down", function()
		local function Wrapper(props)
			return React.createElement(
				"Frame",
				nil,
				props.children,
				React.createElement("Frame")
			)
		end

		-- ROBLOX deviation: Add expectation to make sure we get _no_ errors
		jestExpect(function()
			ReactTestUtils.renderIntoDocument(
				React.createElement(
					Wrapper,
					nil,
					React.createElement("Frame"),
					React.createElement("Frame")
				)
			)
		end).toErrorDev({})
	end)

	-- ROBLOX deviation: This test is unique to roblox; we allow children to
	-- be passed as a table, and use the keys as stable keys for the
	-- equivalent children
	it("does not warn for keys when providing keys via children tables", function()
		-- ROBLOX FIXME: Expect coercion
		jestExpect(function()
			ReactTestUtils.renderIntoDocument(React.createElement("Frame", nil, {
				ChildA = React.createElement("Frame"),
				ChildB = React.createElement("Frame"),
			}))
		end).toErrorDev({})
	end)

	-- ROBLOX deviation: no @@iterator in Lua
	xit("warns for keys for iterables of elements in rest args", function()
		local iterable = {
			["@@iterator"] = function()
				local i = 0
				return {
					next = function()
						i = i + 1
						local done = i > 2
						local value
						if not done then
							value = React.createElement(ComponentClass)
						end
						return {
							value = value,
							done = done,
						}
					end,
				}
			end,
		}

		jestExpect(function()
			return React.createElement(ComponentClass, nil, iterable)
		end).toErrorDev('Each child in a list should have a unique "key" prop.')
	end)

	it("does not warns for arrays of elements with keys", function()
		React.createElement(ComponentClass, nil, {
			React.createElement(ComponentClass, { key = "#1" }),
			React.createElement(ComponentClass, { key = "#2" }),
		})
	end)

	-- ROBLOX deviation: no @@iterator in Lua
	xit("does not warns for iterable elements with keys", function()
		local iterable = {
			["@@iterator"] = function()
				local i = 0
				return {
					next = function()
						i = i + 1
						local done = i > 2
						return {
							value = not done and React.createElement(
								ComponentClass,
								{ key = "#" .. i }
							) or nil,
							done = done,
						}
					end,
				}
			end,
		}

		React.createElement(ComponentClass, nil, iterable)
	end)

	it("does not warn when the element is directly in rest args", function()
		React.createElement(
			ComponentClass,
			nil,
			React.createElement(ComponentClass),
			React.createElement(ComponentClass)
		)
	end)

	it("does not warn when the array contains a non-element", function()
		React.createElement(ComponentClass, nil, { {}, {} })
	end)

	-- ROBLOX TODO: implement PropTypes support
	xit("should give context for PropType errors in nested components.", function()
		-- // In this test, we're making sure that if a proptype error is found in a
		-- // component, we give a small hint as to which parent instantiated that
		-- // component as per warnings about key usage in ReactElementValidator.
		local MyComp = React.Component:extend("MyComp")
		function MyComp:render()
			return React.createElement("Frame", nil, "My color is " .. self.props.color)
		end
		MyComp.propTypes = {
			color = PropTypes.string,
		}
		local function ParentComp()
			return React.createElement(MyComp, { color = 123 })
		end

		jestExpect(function()
			ReactTestUtils.renderIntoDocument(React.createElement(ParentComp))
		end).toErrorDev(
			"Warning: Failed prop type: "
				.. "Invalid prop `color` of type `number` supplied to `MyComp`, "
				.. "expected `string`.\n"
				.. "    in MyComp (at **)\n"
				.. "    in ParentComp (at **)"
		)
	end)

	it("gives a helpful error when passing invalid types", function()
		local function Foo() end

		jestExpect(function()
			React.createElement(nil)
			React.createElement(true)
			React.createElement({ x = 17 })
			React.createElement({})
			React.createElement(React.createElement("Frame"))
			React.createElement(React.createElement(Foo))
			React.createElement(React.createElement(React.createContext().Consumer))
			React.createElement({ ["$$typeof"] = "non-react-thing" })
		end).toErrorDev({
			"Warning: React.createElement: type is invalid -- expected a string "
				.. "(for built-in components) or a class/function (for composite "
				.. "components) but got: nil.",
			"Warning: React.createElement: type is invalid -- expected a string "
				.. "(for built-in components) or a class/function (for composite "
				.. "components) but got: boolean.",
			"Warning: React.createElement: type is invalid -- expected a string "
				.. "(for built-in components) or a class/function (for composite "
				.. "components) but got: table.",
			"Warning: React.createElement: type is invalid -- expected a string "
				.. "(for built-in components) or a class/function (for composite "
				.. "components) but got: array. You likely forgot to export your "
				.. "component from the file it's defined in, or you might have mixed up "
				.. "default and named imports.",
			"Warning: React.createElement: type is invalid -- expected a string "
				.. "(for built-in components) or a class/function (for composite "
				.. "components) but got: <Frame />. Did you accidentally export a JSX literal "
				.. "or Element instead of a component?",
			"Warning: React.createElement: type is invalid -- expected a string "
				.. "(for built-in components) or a class/function (for composite "
				.. "components) but got: <Foo />. Did you accidentally export a JSX literal "
				.. "or Element instead of a component?",
			"Warning: React.createElement: type is invalid -- expected a string "
				.. "(for built-in components) or a class/function (for composite "
				.. "components) but got: <Context.Consumer />. Did you accidentally "
				.. "export a JSX literal or Element instead of a component?",
			"Warning: React.createElement: type is invalid -- expected a string "
				.. "(for built-in components) or a class/function (for composite "
				.. "components) but got: table.\n{",
		}, { withoutStack = true })

		-- // Should not log any additional warnings
		React.createElement("Frame")
	end)

	it(
		"includes the owner name when passing null, undefined, boolean, or number",
		function()
			local function ParentComp()
				-- ROBLOX DEVIATION: The test says "null, undefined, boolean, or
				-- number", but uses `null`, which it treats differently from
				-- `undefined`. Here, we're passing a number, which should have
				-- behavior identical to upstream
				return React.createElement(1)
			end

			jestExpect(function()
				jestExpect(function()
					ReactTestUtils.renderIntoDocument(React.createElement(ParentComp))
				end).toThrowError(
					"Element type is invalid: expected a string (for built-in components) "
						.. "or a class/function (for composite components) but got: number."
						.. (
							_G.__DEV__
								and "\n\nCheck the render method of `ParentComp`."
							or ""
						)
				)
			end).toErrorDev(
				"Warning: React.createElement: type is invalid -- expected a string "
					.. "(for built-in components) or a class/function (for composite "
					.. "components) but got: number."
				-- ROBLOX FIXME: Error output differs
				-- "\n\nCheck the render method of `ParentComp`.\n    in ParentComp",
			)
		end
	)

	-- ROBLOX deviation: Regression test for error output issue
	it("includes the owner name of a PureComponent", function()
		local ParentPureComp = React.PureComponent:extend("ParentPureComp")
		function ParentPureComp:render()
			return React.createElement(1)
		end

		jestExpect(function()
			jestExpect(function()
				ReactTestUtils.renderIntoDocument(React.createElement(ParentPureComp))
			end).toThrowError(
				"Element type is invalid: expected a string (for built-in components) "
					.. "or a class/function (for composite components) but got: number."
					.. (
						_G.__DEV__
							and "\n\nCheck the render method of `ParentPureComp`."
						or ""
					)
			)
		end).toErrorDev(
			"Warning: React.createElement: type is invalid -- expected a string "
				.. "(for built-in components) or a class/function (for composite "
				.. "components) but got: number."
			-- ROBLOX FIXME: Error output differs
			-- "\n\nCheck the render method of `ParentPureComp`.\n    in ParentPureComp"
		)
	end)

	-- ROBLOX TODO: implement PropTypes
	it.skip("should check default prop values", function()
		local Component = React.Component:extend("Component")
		function Component:render()
			return React.createElement("Frame", nil, self.props.prop)
		end
		Component.propTypes = {
			prop = PropTypes.string.isRequired,
		}
		Component.defaultProps = { prop = nil }

		jestExpect(function()
			return ReactTestUtils.renderIntoDocument(React.createElement(Component))
		end).toErrorDev(
			"Warning: Failed prop type: The prop `prop` is marked as required in "
				.. "`Component`, but its value is `null`.\n"
				.. "    in Component"
		)
	end)

	-- ROBLOX TODO: implement PropTypes
	it.skip("should not check the default for explicit null", function()
		local Component = React.Component:extend("Component")
		function Component:render()
			return React.createElement("Frame", nil, self.props.prop)
		end
		Component.propTypes = {
			prop = PropTypes.string.isRequired,
		}
		Component.defaultProps = {
			prop = "text",
		}

		jestExpect(function()
			ReactTestUtils.renderIntoDocument(
				React.createElement(Component, { prop = nil })
			)
		end).toErrorDev(
			"Warning: Failed prop type: The prop `prop` is marked as required in "
				.. "`Component`, but its value is `null`.\n"
				.. "    in Component"
		)
	end)

	-- ROBLOX TODO: implement PropTypes
	it.skip("should check declared prop types", function()
		local Component = React.Component:extend("Component")
		function Component:render()
			return React.createElement("Frame", nil, self.props.prop)
		end
		Component.propTypes = {
			prop = PropTypes.string.isRequired,
		}

		jestExpect(function()
			ReactTestUtils.renderIntoDocument(React.createElement(Component))
			ReactTestUtils.renderIntoDocument(
				React.createElement(Component, { prop = 42 })
			)
		end).toErrorDev({
			"Warning: Failed prop type: "
				.. "The prop `prop` is marked as required in `Component`, but its value "
				.. "is `undefined`.\n"
				.. "    in Component",
			"Warning: Failed prop type: "
				.. "Invalid prop `prop` of type `number` supplied to "
				.. "`Component`, expected `string`.\n"
				.. "    in Component",
		})

		-- // Should not error for strings
		ReactTestUtils.renderIntoDocument(React.createElement(Component, {
			prop = "string",
		}))
	end)

	-- ROBLOX TODO: implement PropTypes
	it.skip("should warn if a PropType creator is used as a PropType", function()
		local Component = React.Component:extend("Component")
		function Component:render()
			return React.createElement("Frame", nil, self.props.myProp.value)
		end
		Component.propTypes = {
			myProp = PropTypes.shape,
		}

		jestExpect(function()
			ReactTestUtils.renderIntoDocument(
				React.createElement(Component, { myProp = { value = "hi" } })
			)
		end).toErrorDev(
			"Warning: Component: type specification of prop `myProp` is invalid; "
				.. "the type checker function must return `null` or an `Error` but "
				.. "returned a function. You may have forgotten to pass an argument to "
				.. "the type checker creator (arrayOf, instanceOf, objectOf, oneOf, "
				.. "oneOfType, and shape all require an argument)."
		)
	end)

	-- ROBLOX TODO: implement PropTypes
	it.skip("should warn if component declares PropTypes instead of propTypes", function()
		local MisspelledPropTypesComponent =
			React.Component:extend("MisspelledPropTypesComponent")
		function MisspelledPropTypesComponent:render()
			return React.createElement("Frame", nil, self.props.prop)
		end
		MisspelledPropTypesComponent.PropTypes = {
			prop = PropTypes.string,
		}

		jestExpect(function()
			ReactTestUtils.renderIntoDocument(
				React.createElement(MisspelledPropTypesComponent, { prop = "Hi" })
			)
		end).toErrorDev(
			"Warning: Component MisspelledPropTypesComponent declared `PropTypes` "
				.. "instead of `propTypes`. Did you misspell the property assignment?",
			{ withoutStack = true }
		)
	end)

	it("warns for fragments with illegal attributes", function()
		local Foo = React.Component:extend("Foo")
		function Foo:render()
			-- ROBLOX deviation: Use an actual child element instead of a
			-- text instance, which is unsupported in ReactRoblox
			return React.createElement(
				React.Fragment,
				{ a = 1 },
				React.createElement("Frame")
			)
		end
		jestExpect(function()
			ReactTestUtils.renderIntoDocument(React.createElement(Foo))
		end).toErrorDev(
			"Invalid prop `a` supplied to `React.Fragment`. React.Fragment "
				.. "can only have `key` and `children` props."
		)
	end)

	if not _G.__EXPERIMENTAL__ then
		-- ROBLOX deviation: createFactory is deprecated in React so it is removed in
		-- the Lua version
		it.skip("should warn when accessing .type on an element factory", function()
			local function TestComponent()
				return React.createElement("Frame")
			end

			local TestFactory

			jestExpect(function()
				TestFactory = React.createFactory(TestComponent)
			end).toWarnDev(
				"Warning: React.createFactory() is deprecated and will be removed in a "
					.. "future major release. Consider using JSX or use React.createElement() "
					.. "directly instead.",
				{ withoutStack = true }
			)
			jestExpect(function()
				return TestFactory.type
			end).toWarnDev(
				"Warning: Factory.type is deprecated. Access the class directly before "
					.. "passing it to createFactory.",
				{ withoutStack = true }
			)

			-- // Warn once, not again
			jestExpect(TestFactory.type).toBe(TestComponent)
		end)
	end

	-- ROBLOX deviation: usage of web browser document global
	it.skip("does not warn when using DOM node as children", function()
		-- local DOMContainer = React.Component:extend("DOMContainer")
		-- function DOMContainer:render()
		-- 	return React.createElement("Frame")
		-- end
		-- function DOMContainer:componentDidMount()
		-- 	ReactDOM.findDOMNode(self).appendChild(self.props.children);
		-- end

		-- local node = document.createElement("Frame")
		-- -- // This shouldn't cause a stack overflow or any other problems (#3883)
		-- ReactTestUtils.renderIntoDocument(
		-- 	React.createElement(DOMContainer, nil, node)
		-- )
	end)

	-- ROBLOX deviation: not applicable in Lua
	it.skip("should not enumerate enumerable numbers (#4776)", function()
		-- Number.prototype['@@iterator'] = function()
		-- 	error("number iterator called")
		-- end
	end)

	it("does not blow up with inlined children", function()
		-- // We don't suggest this since it silences all sorts of warnings, but we
		-- // shouldn't blow up either.

		local child = {
			["$$typeof"] = React.createElement("Frame")["$$typeof"],
			type = "Frame",
			key = nil,
			ref = nil,
			props = {},
			_owner = nil,
		}

		React.createElement("Frame", nil, { child })
	end)

	it("does not blow up on key warning with undefined type", function()
		local Foo = nil

		jestExpect(function()
			React.createElement(Foo, {
				__source = {
					fileName = "fileName.lua",
					lineNumber = 100,
				},
			}, { React.createElement("Frame") })
		end).toErrorDev(
			"Warning: React.createElement: type is invalid -- expected a string "
				.. "(for built-in components) or a class/function (for composite "
				.. "components) but got: nil. You likely forgot to export your "
				.. "component from the file it's defined in, or you might have mixed up "
				.. "default and named imports.\n\nCheck your code at **.",
			{ withoutStack = true }
		)
	end)

	it("does not call lazy initializers eagerly", function()
		local didCall = false
		local Lazy = React.lazy(function()
			didCall = true
			return { andThen = function() end }
		end)
		React.createElement(Lazy)
		jestExpect(didCall).toBe(false)
	end)

	-- ROBLOX deviation: validate extra warning when using table keys as the
	-- keys provided to child elements
	it("warns when keys are provided via both the 'key' prop AND table keys", function()
		local Component = React.Component:extend("Component")
		function Component:render()
			return React.createElement("Frame", nil, {
				a1 = React.createElement("Frame", { key = "a2" }),
				b = React.createElement("Frame", { key = "b" }),
			})
		end

		jestExpect(function()
			ReactTestUtils.renderIntoDocument(React.createElement(Component))
		end).toErrorDev(
			'Child element received a "key" prop ("a2") in addition to a key in '
				.. 'the "children" table of its parent ("a1"). Please provide only '
				.. 'one key definition. When both are present, the "key" prop '
				.. "will take precedence.\n\nCheck the render method of `Component`. "
				.. "See https://reactjs.org/link/warning-keys for more information.\n"
				.. "    in Frame (at **)\n"
				.. "    in Component (at **)"
		)
	end)
end)
