local H=script.Parent.Parent.Parent.Parent local a=H.Parent local E=require(a.Dev.JestGlobals)local O=E.describe local c=E.expect local t=E.it local V=require(script.Parent.Parent.helpers)local Y=V.getTypenameFromStoreObject local M=V.TypeOrFieldNameRegExp local F=V.fieldNameFromStoreName local R=V.selectionSetMatchesResult local S=V.storeValueIsStoreObject local q=V.makeProcessedFieldsMerger O("\105\110\109\101\109\111\114\121 \104\101\108\112\101\114\115",function()t("\101\110\115\117\114\101 \104\101\108\112\101\114 \102\117\110\099\116\105\111\110\115 \105\109\112\111\114\116 \099\111\114\114\101\099\116\108\121",function()(c(typeof(Y))).toBe("\102\117\110\099\116\105\111\110");(c(typeof(M))).toBe("\116\097\098\108\101");(c(typeof(F))).toBe("\102\117\110\099\116\105\111\110");(c(typeof(R))).toBe("\102\117\110\099\116\105\111\110");(c(typeof(S))).toBe("\102\117\110\099\116\105\111\110");(c(typeof(q))).toBe("\102\117\110\099\116\105\111\110")end)O("\102\105\101\108\100\078\097\109\101\070\114\111\109\083\116\111\114\101\078\097\109\101",function()t("\115\104\111\117\108\100 \110\111\116 \109\097\116\099\104 \102\111\114 \102\105\101\108\100 \110\097\109\101\115 \115\116\097\114\116\105\110\103 \119\105\116\104 \097 \110\117\109\098\101\114",function()(c(F("\051\097\098\099"))).toEqual("\051\097\098\099")end)t("\115\104\111\117\108\100 \109\097\116\099\104 \102\111\114 \102\105\101\108\100\115 \115\116\097\114\116\105\110\103 \119\105\116\104 \095",function()(c(F("\095\104\051\108\108\111"))).toEqual("\095\104\051\108\108\111");(c(F("\095\072\051\076\108\111"))).toEqual("\095\072\051\076\108\111");(c(F("\095\072\069\076\076\079"))).toEqual("\095\072\069\076\076\079")end)t("\115\104\111\117\108\100 \110\111\116 \109\097\116\099\104 \110\111\110-\097\108\112\104\097\110\117\109\101\114\105\099 \115\116\097\114\116\105\110\103 \099\104\097\114\097\099\116\101\114\115",function()(c(F("\036\095\104\101\108\108\111"))).toEqual("\036\095\104\101\108\108\111")end)t("\115\104\111\117\108\100 \110\111\116 \109\097\116\099\104 \117\110\105\099\111\100\101 \115\116\097\114\116\105\110\103 \099\104\097\114\097\099\116\101\114\115",function()(c(F("\195\162\095\104\101\108\108\111"))).toEqual("\195\162\095\104\101\108\108\111")end)t("\115\104\111\117\108\100 \109\097\116\099\104 \102\111\114 \097\108\112\104\097\098\101\116\105\099 \115\116\097\114\116\105\110\103 \099\104\097\114\097\099\116\101\114\115",function()(c(F("\104\101\108\050\108\111\095"))).toEqual("\104\101\108\050\108\111\095");(c(F("\072\095\101\076\108\111"))).toEqual("\072\095\101\076\108\111");(c(F("\072\069\076\076\079"))).toEqual("\072\069\076\076\079")end)t("\115\104\111\117\108\100 \115\116\111\112 \109\097\116\099\104\105\110\103 \097\116 \110\111\110-\097\108\112\104\097\110\117\109\098\101\114\105\099 \099\104\097\114\097\099\116\101\114",function()(c(F("\104\101\108\108\111\036\103\111\111\100\098\121\101"))).toEqual("\104\101\108\108\111");(c(F("\095\104\101\108\108\111\036\103\111\111\100\098\121\101"))).toEqual("\095\104\101\108\108\111");(c(F("\104\095\101\095\051\095\108\095\111\036\103\111\111\100\098\121\101"))).toEqual("\104\095\101\095\051\095\108\095\111")end)end)end)return{}
--[[
 * Copyright (c) Roblox Corporation
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
]]
-- ROBLOX upstream: no upstream
local srcWorkspace = script.Parent.Parent.Parent.Parent
local rootWorkspace = srcWorkspace.Parent

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

local helpersModule = require(script.Parent.Parent.helpers)
local getTypenameFromStoreObject = helpersModule.getTypenameFromStoreObject
local TypeOrFieldNameRegExp = helpersModule.TypeOrFieldNameRegExp
local fieldNameFromStoreName = helpersModule.fieldNameFromStoreName
local selectionSetMatchesResult = helpersModule.selectionSetMatchesResult
local storeValueIsStoreObject = helpersModule.storeValueIsStoreObject
local makeProcessedFieldsMerger = helpersModule.makeProcessedFieldsMerger

describe("inmemory helpers", function()
	it("ensure helper functions import correctly", function()
		expect(typeof(getTypenameFromStoreObject)).toBe("function")
		expect(typeof(TypeOrFieldNameRegExp)).toBe("table")
		expect(typeof(fieldNameFromStoreName)).toBe("function")
		expect(typeof(selectionSetMatchesResult)).toBe("function")
		expect(typeof(storeValueIsStoreObject)).toBe("function")
		expect(typeof(makeProcessedFieldsMerger)).toBe("function")
	end)

	describe("fieldNameFromStoreName", function()
		it("should not match for field names starting with a number", function()
			expect(fieldNameFromStoreName("3abc")).toEqual("3abc")
		end)

		it("should match for fields starting with _", function()
			expect(fieldNameFromStoreName("_h3llo")).toEqual("_h3llo")
			expect(fieldNameFromStoreName("_H3Llo")).toEqual("_H3Llo")
			expect(fieldNameFromStoreName("_HELLO")).toEqual("_HELLO")
		end)

		it("should not match non-alphanumeric starting characters", function()
			expect(fieldNameFromStoreName("$_hello")).toEqual("$_hello")
		end)

		it("should not match unicode starting characters", function()
			expect(fieldNameFromStoreName("â_hello")).toEqual("â_hello")
		end)

		it("should match for alphabetic starting characters", function()
			expect(fieldNameFromStoreName("hel2lo_")).toEqual("hel2lo_")
			expect(fieldNameFromStoreName("H_eLlo")).toEqual("H_eLlo")
			expect(fieldNameFromStoreName("HELLO")).toEqual("HELLO")
		end)

		it("should stop matching at non-alphanumberic character", function()
			expect(fieldNameFromStoreName("hello$goodbye")).toEqual("hello")
			expect(fieldNameFromStoreName("_hello$goodbye")).toEqual("_hello")
			expect(fieldNameFromStoreName("h_e_3_l_o$goodbye")).toEqual("h_e_3_l_o")
		end)
	end)
end)

return {}
