persona-community-5/.pnpm-store/v3/files/cd/62d04000eb7fde5b2623dbe8f7dd173806770cf1a41d3eb64e68dc6e65fd7ccfa9d714447d76e3b36e60339e8664aa0f1a8d6ab37ed530fef2650ecb65150b
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

64 lines
1.7 KiB
Plaintext

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