persona-community-5/.pnpm-store/v3/files/16/49d71e01a6141614af89fb03a1c8faad2359ada28a5e50d81f890d748a644cd4d170e05a0e1b0b635dd7431c7505ff0c80ce8f6b6b413094510aa6f4f55be4
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

73 lines
1.9 KiB
Plaintext

import { outdent } from 'outdent';
import { lintDocument } from '../../../lint';
import { parseYamlToDocument, replaceSourceWithRef, makeConfig } from '../../../../__tests__/utils';
import { BaseResolver } from '../../../resolve';
describe('Oas3 operation-singular-tag', () => {
it('should report on operation object if more than one tag', async () => {
const document = parseYamlToDocument(
outdent`
openapi: 3.0.0
tags:
- name: a
- name: b
paths:
/some:
get:
tags:
- a
- b
`,
'foobar.yaml'
);
const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: await makeConfig({ rules: { 'operation-singular-tag': 'error' } }),
});
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
[
{
"location": [
{
"pointer": "#/paths/~1some/get/tags",
"reportOnKey": true,
"source": "foobar.yaml",
},
],
"message": "Operation \`tags\` object should have only one tag.",
"ruleId": "operation-singular-tag",
"severity": "error",
"suggest": [],
},
]
`);
});
it('should not report on operation object if only one tag', async () => {
const document = parseYamlToDocument(
outdent`
openapi: 3.0.0
tags:
- name: a
paths:
/some:
get:
tags:
- a
`,
'foobar.yaml'
);
const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: await makeConfig({ rules: { 'operation-singular-tag': 'error' } }),
});
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
});
});