local Z=script.Parent.Parent.Parent.Parent.Parent local O=require(Z.Dev.JestGlobals)local y=O.describe local S=O.expect local G=O.it local g=(require(Z.GraphQLTag)).default local T=(require(script.Parent.Parent.Parent.utils.createOperation)).createOperation local K=(require(script.Parent.Parent.selectURI)).selectURI local c=g("\n\t\t\113\117\101\114\121 \083\097\109\112\108\101\081\117\101\114\121 \123\n\t\t\t\115\116\117\098 \123\n\t\t\t\t\105\100\n\t\t\t\125\n\t\t\125\n\t")y("\115\101\108\101\099\116\085\082\073",function()G("\114\101\116\117\114\110\115 \097 \112\097\115\115\101\100 \105\110 \115\116\114\105\110\103",function()local Z="\047\115\111\109\101\119\104\101\114\101"local O=T({uri=Z},{query=c});(S(K(O))).toEqual(Z)end)G("\114\101\116\117\114\110\115 \097 \102\097\108\108\098\097\099\107 \111\102 \047\103\114\097\112\104\113\108",function()local Z="\047\103\114\097\112\104\113\108"local O=T({},{query=c});(S(K(O))).toEqual(Z)end)G("\114\101\116\117\114\110\115 \116\104\101 \114\101\115\117\108\116 \111\102 \097 \085\114\105\070\117\110\099\116\105\111\110",function()local Z="\047\115\111\109\101\119\104\101\114\101"local O=T({},{query=c});(S(K(O,function()return Z end))).toEqual(Z)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/link/http/__tests__/selectURI.ts

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

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

local gql = require(rootWorkspace.GraphQLTag).default

local createOperation = require(script.Parent.Parent.Parent.utils.createOperation).createOperation
local selectURI = require(script.Parent.Parent.selectURI).selectURI

local query = gql([[

		query SampleQuery {
			stub {
				id
			}
		}
	]])

describe("selectURI", function()
	it("returns a passed in string", function()
		local uri = "/somewhere"
		local operation = createOperation({ uri = uri }, { query = query })
		expect(selectURI(operation)).toEqual(uri)
	end)

	it("returns a fallback of /graphql", function()
		local uri = "/graphql"
		local operation = createOperation({}, { query = query })
		expect(selectURI(operation)).toEqual(uri)
	end)

	it("returns the result of a UriFunction", function()
		local uri = "/somewhere"
		local operation = createOperation({}, { query = query })
		expect(selectURI(operation, function()
			return uri
		end)).toEqual(uri)
	end)
end)

return {}
