persona-community-5/.pnpm-store/v3/files/9d/c6193c99106bce8c2ea04eab005207cc6af322abd43e3285f4b42dd86d9ac38faa22e6037bb491199d31ee6e56ba8c5407b3f2e6af9231f3724822ce6ae2ff
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

79 lines
2.4 KiB
Plaintext

import { outdent } from 'outdent';
import { lintDocument } from '../../../lint';
import { parseYamlToDocument, replaceSourceWithRef, makeConfig } from '../../../../__tests__/utils';
import { BaseResolver } from '../../../resolve';
describe('Arazzo sourceDescription-type', () => {
const document = parseYamlToDocument(
outdent`
arazzo: '1.0.1'
info:
title: Cool API
version: 1.0.0
description: A cool API
sourceDescriptions:
- name: museum-api
type: openapi
url: openapi.yaml
- name: api
type: none
x-serverUrl: 'http://localhost/api'
workflows:
- workflowId: get-museum-hours
description: This workflow demonstrates how to get the museum opening hours and buy tickets.
parameters:
- in: header
name: Authorization
value: Basic Og==
steps:
- stepId: get-museum-hours
description: >-
Get museum hours by resolving request details with getMuseumHours operationId from openapi.yaml description.
operationId: museum-api.getMuseumHours
successCriteria:
- condition: $statusCode == 200
`,
'arazzo.yaml'
);
it('should report on sourceDescription with type `none`', async () => {
const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: await makeConfig({
rules: { 'sourceDescription-type': 'error' },
}),
});
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
[
{
"location": [
{
"pointer": "#/sourceDescriptions/1",
"reportOnKey": false,
"source": "arazzo.yaml",
},
],
"message": "The \`type\` property of the \`sourceDescription\` object must be either \`openapi\` or \`arazzo\`.",
"ruleId": "sourceDescription-type",
"severity": "error",
"suggest": [],
},
]
`);
});
it('should not report on sourceDescription with type `none`', async () => {
const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: await makeConfig({
rules: { 'sourceDescription-type': 'off' },
}),
});
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
});
});