persona-community-5/.pnpm-store/v3/files/0c/6c86e6da87edef4660fb93f6779e64ab35fb2f90253e34df3833c14b8a2e9fd7066331b2e2de9a076a83d5a52d4ccba70cf31a43cabdd5b8076d85c6781ff0
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

89 lines
2.8 KiB
Plaintext

import { outdent } from 'outdent';
import { lintDocument } from '../../../lint';
import { parseYamlToDocument, replaceSourceWithRef, makeConfig } from '../../../../__tests__/utils';
import { BaseResolver } from '../../../resolve';
describe('Arazzo workflowId-unique', () => {
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
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
- 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 workflowId unique violation', async () => {
const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: await makeConfig({
rules: { 'workflowId-unique': 'error' },
}),
});
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
[
{
"location": [
{
"pointer": "#/workflows/1/get-museum-hours",
"reportOnKey": false,
"source": "arazzo.yaml",
},
],
"message": "Every workflow must have a unique \`workflowId\`.",
"ruleId": "workflowId-unique",
"severity": "error",
"suggest": [],
},
]
`);
});
it('should not report on workflowId unique violation', async () => {
const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: await makeConfig({
rules: { 'workflowId-unique': 'off' },
}),
});
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
});
});