local c=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 H=c.beforeEach local e=c.expect local n=c.it local v=c.jest local Q H(function()v.resetModules()Q=require("\046\046\047\102\111\114\109\097\116\080\114\111\100\069\114\114\111\114\077\101\115\115\097\103\101")end)n("\115\104\111\117\108\100 \116\104\114\111\119 \119\105\116\104 \116\104\101 \099\111\114\114\101\099\116 \110\117\109\098\101\114 \111\102 \096\037\115\096\115 \105\110 \116\104\101 \085\082\076",function()(e(Q(124,"\102\111\111","\098\097\114"))).toEqual("\077\105\110\105\102\105\101\100 \082\101\097\099\116 \101\114\114\111\114 \035\049\050\052\059 \118\105\115\105\116 \104\116\116\112\115\058\047\047\114\101\097\099\116\106\115\046\111\114\103\047\100\111\099\115\047\101\114\114\111\114-\100\101\099\111\100\101\114\046\104\116\109\108\063\105\110\118\097\114\105\097\110\116\061\049\050\052\038\097\114\103\115\091\093\061\102\111\111\038\097\114\103\115\091\093\061\098\097\114 \102\111\114 \116\104\101 \102\117\108\108 \109\101\115\115\097\103\101 \111\114 \117\115\101 \116\104\101 \110\111\110-\109\105\110\105\102\105\101\100 \100\101\118 \101\110\118\105\114\111\110\109\101\110\116 \102\111\114 \102\117\108\108 \101\114\114\111\114\115 \097\110\100 \097\100\100\105\116\105\111\110\097\108 \104\101\108\112\102\117\108 \119\097\114\110\105\110\103\115\046");(e(Q(20))).toEqual("\077\105\110\105\102\105\101\100 \082\101\097\099\116 \101\114\114\111\114 \035\050\048\059 \118\105\115\105\116 \104\116\116\112\115\058\047\047\114\101\097\099\116\106\115\046\111\114\103\047\100\111\099\115\047\101\114\114\111\114-\100\101\099\111\100\101\114\046\104\116\109\108\063\105\110\118\097\114\105\097\110\116\061\050\048 \102\111\114 \116\104\101 \102\117\108\108 \109\101\115\115\097\103\101 \111\114 \117\115\101 \116\104\101 \110\111\110-\109\105\110\105\102\105\101\100 \100\101\118 \101\110\118\105\114\111\110\109\101\110\116 \102\111\114 \102\117\108\108 \101\114\114\111\114\115 \097\110\100 \097\100\100\105\116\105\111\110\097\108 \104\101\108\112\102\117\108 \119\097\114\110\105\110\103\115\046");(e(Q(77,"\060\100\105\118\062","\038\063\098\097\114"))).toEqual("\077\105\110\105\102\105\101\100 \082\101\097\099\116 \101\114\114\111\114 \035\055\055\059 \118\105\115\105\116 \104\116\116\112\115\058\047\047\114\101\097\099\116\106\115\046\111\114\103\047\100\111\099\115\047\101\114\114\111\114-\100\101\099\111\100\101\114\046\104\116\109\108\063\105\110\118\097\114\105\097\110\116\061\055\055\038\097\114\103\115\091\093\061\037\051\067\100\105\118\037\051\069\038\097\114\103\115\091\093\061\037\050\054\037\051\070\098\097\114 \102\111\114 \116\104\101 \102\117\108\108 \109\101\115\115\097\103\101 \111\114 \117\115\101 \116\104\101 \110\111\110-\109\105\110\105\102\105\101\100 \100\101\118 \101\110\118\105\114\111\110\109\101\110\116 \102\111\114 \102\117\108\108 \101\114\114\111\114\115 \097\110\100 \097\100\100\105\116\105\111\110\097\108 \104\101\108\112\102\117\108 \119\097\114\110\105\110\103\115\046")end)
-- ROBLOX upstream: https://github.com/facebook/react/blob/9a5576f4d263ac5d7a9462a287d1524fda3355b8/packages/shared/__tests__/ReactErrorProd-test.internal.js
--[[*
 * 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
]]
--!strict

local JestGlobals = require("@pkg/@jsdotlua/jest-globals")
local beforeEach = JestGlobals.beforeEach
local jestExpect = JestGlobals.expect
local it = JestGlobals.it
local jest = JestGlobals.jest
local formatProdErrorMessage

beforeEach(function()
	jest.resetModules()
	formatProdErrorMessage = require("../formatProdErrorMessage")
end)

it("should throw with the correct number of `%s`s in the URL", function()
	jestExpect(formatProdErrorMessage(124, "foo", "bar")).toEqual(
		"Minified React error #124; visit "
			.. "https://reactjs.org/docs/error-decoder.html?invariant=124&args[]=foo&args[]=bar"
			.. " for the full message or use the non-minified dev environment"
			.. " for full errors and additional helpful warnings."
	)

	jestExpect(formatProdErrorMessage(20)).toEqual(
		"Minified React error #20; visit "
			.. "https://reactjs.org/docs/error-decoder.html?invariant=20"
			.. " for the full message or use the non-minified dev environment"
			.. " for full errors and additional helpful warnings."
	)

	jestExpect(formatProdErrorMessage(77, "<div>", "&?bar")).toEqual(
		"Minified React error #77; visit "
			.. "https://reactjs.org/docs/error-decoder.html?invariant=77&args[]=%3Cdiv%3E&args[]=%26%3Fbar"
			.. " for the full message or use the non-minified dev environment"
			.. " for full errors and additional helpful warnings."
	)
end)
