Skip to content

Commit

Permalink
why
Browse files Browse the repository at this point in the history
  • Loading branch information
n1ru4l committed Jan 26, 2024
1 parent 98b90c9 commit 28603c1
Showing 1 changed file with 67 additions and 48 deletions.
115 changes: 67 additions & 48 deletions __tests__/supergraph/errors/REQUIRED_INACCESSIBLE.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,72 @@ import { graphql, testVersions } from '../../shared/testkit.js';

testVersions((api, version) => {
test('REQUIRED_INACCESSIBLE', () => {
expect(
api.composeServices([
{
name: 'users',
typeDefs: graphql`
extend schema
@link(
url: "https://specs.apollo.dev/federation/${version}"
import: ["@key", "@inaccessible"]
)
// expect(
// api.composeServices([
// {
// name: 'users',
// typeDefs: graphql`
// extend schema
// @link(
// url: "https://specs.apollo.dev/federation/${version}"
// import: ["@key", "@inaccessible"]
// )

type Query {
a(id: ID! @inaccessible): Int!
}
`,
},
]),
).toEqual(
expect.objectContaining({
errors: expect.arrayContaining([
expect.objectContaining({
message:
'Argument "Query.a(id:)" is @inaccessible but is a required argument of its field.',
extensions: expect.objectContaining({
code: 'REQUIRED_INACCESSIBLE',
}),
}),
]),
}),
);
// type Query {
// a(id: ID! @inaccessible): Int!
// }
// `,
// },
// ]),
// ).toEqual(
// expect.objectContaining({
// errors: expect.arrayContaining([
// expect.objectContaining({
// message:
// 'Argument "Query.a(id:)" is @inaccessible but is a required argument of its field.',
// extensions: expect.objectContaining({
// code: 'REQUIRED_INACCESSIBLE',
// }),
// }),
// ]),
// }),
// );

// expect(
// api.composeServices([
// {
// name: 'users',
// typeDefs: graphql`
// extend schema
// @link(
// url: "https://specs.apollo.dev/federation/${version}"
// import: ["@key", "@inaccessible"]
// )

// input A {
// id: ID! @inaccessible
// b: Int
// }

// type Query {
// a(a: A): Int!
// }
// `,
// },
// ]),
// ).toEqual(
// expect.objectContaining({
// errors: expect.arrayContaining([
// expect.objectContaining({
// message:
// 'Input field "A.id" is @inaccessible but is a required input field of its type.',
// extensions: expect.objectContaining({
// code: 'REQUIRED_INACCESSIBLE',
// }),
// }),
// ]),
// }),
// );

expect(
api.composeServices([
Expand All @@ -45,29 +81,12 @@ testVersions((api, version) => {
import: ["@key", "@inaccessible"]
)
input A {
id: ID! @inaccessible
b: Int
}
type Query {
a(a: A): Int!
a(id: ID!): Int!
}
`,
},
]),
).toEqual(
expect.objectContaining({
errors: expect.arrayContaining([
expect.objectContaining({
message:
'Input field "A.id" is @inaccessible but is a required input field of its type.',
extensions: expect.objectContaining({
code: 'REQUIRED_INACCESSIBLE',
}),
}),
]),
}),
);
).toEqual({});
});
});

0 comments on commit 28603c1

Please sign in to comment.