Skip to content

Commit 3495529

Browse files
committed
interfaces should implement node too
1 parent 328a3f5 commit 3495529

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

packages/federation/tests/globalObjectIdentification.test.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ describe('Global Object Identification', () => {
2626
): Node
2727
}
2828
29-
interface Actor {
29+
interface Actor implements Node {
3030
id: ID!
3131
name: String!
32+
"""
33+
A globally unique identifier. Can be used in various places throughout the system to identify this single value.
34+
"""
35+
nodeId: ID!
3236
}
3337
3438
type Organization implements Actor & Node {
@@ -158,6 +162,34 @@ describe('Global Object Identification', () => {
158162
`);
159163
});
160164

165+
it('should resolve single field key interface', async () => {
166+
const { data, execute } = await getSchema();
167+
168+
await expect(
169+
execute({
170+
query: /* GraphQL */ `
171+
{
172+
node(nodeId: "${toGlobalId('Organization', data.organizations[0].id)}") {
173+
... on Actor {
174+
nodeId
175+
name
176+
}
177+
}
178+
}
179+
`,
180+
}),
181+
).resolves.toMatchInlineSnapshot(`
182+
{
183+
"data": {
184+
"node": {
185+
"name": "Foo Inc.",
186+
"nodeId": "T3JnYW5pemF0aW9uOm8z",
187+
},
188+
},
189+
}
190+
`);
191+
});
192+
161193
it('should resolve multiple fields key object', async () => {
162194
const { data, execute } = await getSchema();
163195

0 commit comments

Comments
 (0)