persona-community-5/.pnpm-store/v3/files/8f/f32505ce4d0c36105ef6fef45d8cbea1b4f33fde2fc21dd2a12267a35501578e47aabdb9b31545ae452a971bdeae2bc04b9fd5f002bf967208c72fb916f7c0
rdev-worker a1d0d1bf1c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature community-ui --requirements 'Build the React commu...
2026-02-24 08:22:30 +00:00

65 lines
1.8 KiB
Plaintext

import { outdent } from 'outdent';
import { lintDocument } from '../../../lint';
import { parseYamlToDocument, replaceSourceWithRef, makeConfig } from '../../../../__tests__/utils';
import { BaseResolver } from '../../../resolve';
describe('Oas3 path-not-include-query', () => {
it('should report on path object if query params in pathitem', async () => {
const document = parseYamlToDocument(
outdent`
openapi: 3.0.0
paths:
/some?input:
get:
summary: List all pets
`,
'foobar.yaml'
);
const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: await makeConfig({ rules: { 'path-not-include-query': 'error' } }),
});
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
[
{
"location": [
{
"pointer": "#/paths/~1some?input",
"reportOnKey": true,
"source": "foobar.yaml",
},
],
"message": "Don't put query string items in the path, they belong in parameters with \`in: query\`.",
"ruleId": "path-not-include-query",
"severity": "error",
"suggest": [],
},
]
`);
});
it('should not report on path object if no query params in pathitem', async () => {
const document = parseYamlToDocument(
outdent`
openapi: 3.0.0
paths:
/some:
get:
summary: List all pets
`,
'foobar.yaml'
);
const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: await makeConfig({ rules: { 'path-not-include-query': 'error' } }),
});
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
});
});