persona-community-5/.pnpm-store/v3/files/b7/70e26f09a6cc2b8e69b79350920da98f33753bb14def5a7e7524f4f621a3a0580be8c360edc5171ede2bc01acaa05b20fd04d5cc596d4ef386575c818543ee
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

66 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 tag-description', () => {
it('should report on tags with no description', async () => {
const document = parseYamlToDocument(
outdent`
openapi: 3.0.0
tags:
- name: firstTag
- name: secondTag
description: some description goes here
`,
'foobar.yaml'
);
const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: await makeConfig({ rules: { 'tag-description': 'error' } }),
});
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
[
{
"location": [
{
"pointer": "#/tags/0/description",
"reportOnKey": true,
"source": "foobar.yaml",
},
],
"message": "Tag object should contain \`description\` field.",
"ruleId": "tag-description",
"severity": "error",
"suggest": [],
},
]
`);
});
it('should not report on tags with description', async () => {
const document = parseYamlToDocument(
outdent`
openapi: 3.0.0
tags:
- name: firstTag
description: bla
- name: secondTag
description: some description goes here
`,
'foobar.yaml'
);
const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: await makeConfig({ rules: { 'tag-description': 'error' } }),
});
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
});
});