Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/services/policy/__tests__/policy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,25 @@ describe('policy checks', () => {
]
`);
});

test('errors can be ignored using eslint-disable-next-line', async () => {
const result = await schemaPolicyApiRouter
.createCaller({ req: { log: console } as any })
.checkPolicy({
source: `
"""
The root query type
"""
# eslint-disable-next-line
type Query { foo: String! }
`,
schema: 'type Query { foo: String! }',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The schema property should be consistent with the source property (excluding ESLint comments). The source includes a description for the Query type, but the schema string does not. While this might not affect this specific test, it's a good practice to keep them aligned to avoid potential issues with other rules that might rely on descriptions or other parts of the schema's AST.

Suggested change
schema: 'type Query { foo: String! }',
schema: '"""The root query type""" type Query { foo: String! }',

target: '1',
policy: {
'require-nullable-result-in-root': ['error'],
},
});

expect(result.length).toBe(0);
});
});
Loading