persona-community-5/.pnpm-store/v3/files/b2/637806e80657cb5fb85b14279f4de1ddeecccba853d21d898da4723f48d4407559405aec4a9bd6eb06f146016a038daf334c1a6b250ca1aff1835c45f624b1
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

69 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 operation-tag-defined', () => {
it('should not report on operation object if at least one tag is defined', async () => {
const document = parseYamlToDocument(
outdent`
openapi: 3.0.4
tags:
- name: a
paths:
/some:
get:
tags:
- a
`,
'foobar.yaml'
);
const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: await makeConfig({ rules: { 'operation-tag-defined': 'error' } }),
});
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
});
it('should report on operation object if no tags are defined', async () => {
const document = parseYamlToDocument(
outdent`
openapi: 3.0.4
tags:
- name: a
paths:
/some:
get:
`,
'foobar.yaml'
);
const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: await makeConfig({ rules: { 'operation-tag-defined': 'error' } }),
});
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
[
{
"location": [
{
"pointer": "#/paths/~1some/get",
"reportOnKey": true,
"source": "foobar.yaml",
},
],
"message": "Operation tags should be defined",
"ruleId": "operation-tag-defined",
"severity": "error",
"suggest": [],
},
]
`);
});
});