persona-community-5/.pnpm-store/v3/files/0b/8eed6709957a5ac96e38b6255b567910c923eaf25bfeb35191e96ad19abbda039591fe403fbcd5fed600211f8d211a46544c963f42818d10ca2a2071074a69
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

63 lines
1.6 KiB
Plaintext

import { outdent } from 'outdent';
import { lintDocument } from '../../../lint';
import { parseYamlToDocument, replaceSourceWithRef, makeConfig } from '../../../../__tests__/utils';
import { BaseResolver } from '../../../resolve';
describe('Oas3 info-license', () => {
it('should report on info with no license', async () => {
const document = parseYamlToDocument(
outdent`
openapi: 3.0.0
info:
version: '1.0'
`,
'foobar.yaml'
);
const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: await makeConfig({ rules: { 'info-license': 'error' } }),
});
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
[
{
"location": [
{
"pointer": "#/info",
"reportOnKey": true,
"source": "foobar.yaml",
},
],
"message": "Info object should contain \`license\` field.",
"ruleId": "info-license",
"severity": "error",
"suggest": [],
},
]
`);
});
it('should not report on info with license', async () => {
const document = parseYamlToDocument(
outdent`
openapi: 3.0.0
info:
license:
name: MIT
url: google.com
`,
'foobar.yaml'
);
const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: await makeConfig({ rules: { 'info-license': 'error' } }),
});
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
});
});