local d=script.Parent.Parent.Parent.Parent local i=d.Parent local C=require(i.LuauPolyfill)local Y=C.Symbol local r=require(i.Dev.JestGlobals)local l=r.describe local S=r.expect local t=r.it local N=(require(script.Parent.Parent.stripSymbols)).stripSymbols l("\115\116\114\105\112\083\121\109\098\111\108\115",function()t("\115\104\111\117\108\100 \115\116\114\105\112 \115\121\109\098\111\108\115 \040\111\110\108\121\041",function()local d=Y("\105\100")local i={foo="\098\097\114",[d]="\082\079\079\084\095\081\085\069\082\089"};(S(N(i))).toEqual({foo="\098\097\114"})end)t("\115\104\111\117\108\100 \115\116\114\105\112 \115\121\109\098\111\108\115 \040\111\110\108\121\041 \105\110 \110\101\115\116\101\100 \111\098\106\101\099\116\115",function()local d=Y("\105\100")local i={foo="\098\097\114";[d]="\082\079\079\084\095\081\085\069\082\089",nested={foo="\098\097\114";[d]="\082\079\079\084\095\081\085\069\082\089";deeplyNested={foo="\098\097\114",[d]="\082\079\079\084\095\081\085\069\082\089"}}};(S(N(i))).toEqual({foo="\098\097\114";nested={foo="\098\097\114";deeplyNested={foo="\098\097\114"}}})end)t("\111\114\105\103\105\110\097\108 \111\098\106\101\099\116 \105\115 \110\111\116 \109\111\100\105\102\105\101\100",function()local d=Y("\105\100")local i={foo="\098\097\114";[d]="\082\079\079\084\095\081\085\069\082\089"}local C=N(i);(S(C[d])).toBeUndefined();(S(i[d])).toBe("\082\079\079\084\095\081\085\069\082\089")end)end)return{}
--[[
 * Copyright (c) 2021 Apollo Graph, Inc. (Formerly Meteor Development Group, Inc.)
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
]]
-- ROBLOX upstream: https://github.com/apollographql/apollo-client/blob/v3.4.2/src/utilities/testing/__tests__/stripSymbols.ts

local srcWorkspace = script.Parent.Parent.Parent.Parent
local rootWorkspace = srcWorkspace.Parent

local LuauPolyfill = require(rootWorkspace.LuauPolyfill)
local Symbol = LuauPolyfill.Symbol

local JestGlobals = require(rootWorkspace.Dev.JestGlobals)
local describe = JestGlobals.describe
local expect = JestGlobals.expect
local it = JestGlobals.it

local stripSymbols = require(script.Parent.Parent.stripSymbols).stripSymbols
describe("stripSymbols", function()
	it("should strip symbols (only)", function()
		local sym = Symbol("id")
		local data = { foo = "bar", [sym] = "ROOT_QUERY" }
		expect(stripSymbols(data)).toEqual({ foo = "bar" })
	end)

	-- ROBLOX comment: no upstream equivalent
	it("should strip symbols (only) in nested objects", function()
		local sym = Symbol("id")
		local data = {
			foo = "bar",
			[sym] = "ROOT_QUERY",
			nested = {
				foo = "bar",
				[sym] = "ROOT_QUERY",
				deeplyNested = {
					foo = "bar",
					[sym] = "ROOT_QUERY",
				},
			},
		}
		expect(stripSymbols(data)).toEqual({
			foo = "bar",
			nested = { foo = "bar", deeplyNested = { foo = "bar" } },
		})
	end)

	-- ROBLOX comment: no upstream equivalent
	it("original object is not modified", function()
		local sym = Symbol("id")
		local data = {
			foo = "bar",
			[sym] = "ROOT_QUERY",
		}
		local stripped = stripSymbols(data)
		expect(stripped[sym]).toBeUndefined()
		expect(data[sym]).toBe("ROOT_QUERY")
	end)
end)

return {}
