Apollo Federation 集成测试和子图中的扩展类型

问题描述 投票:0回答:0

我目前正在尝试编写一个简单的集成测试来在我的一个子图上运行executeOperation。但是,我的子图的 graphql 架构具有对我的其他子图的实体引用。例如,我正在测试的子图的 .graphql 中的此块。

extend type Collection @key(fields: "id") {
  id: String! @external
  itemId: Int
}

当我尝试运行测试方法时,出现以下错误(仅供参考,ContentId 是在同一架构文件中定义的自定义标量):

Unknown type "Collection". Did you mean "ContentId"?
Cannot extend type "Collection" because it is not defined. Did you mean "ContentId"?
Unknown directive "@key".
Unknown directive "@external".

我假设这是因为测试无法引用其他子图中的实体。文档不是很清楚。我是否应该通过某种方式来模拟这个,或者在联合设置中进行集成测试的其他解决方案?

testing graphql integration-testing apollo-server apollo-federation
© www.soinside.com 2019 - 2024. All rights reserved.