Skip to content

Commit c9168f1

Browse files
committed
feat: Added pathItems tests
1 parent 1a6e2a0 commit c9168f1

File tree

2 files changed

+58
-2
lines changed

2 files changed

+58
-2
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
"update-lock-file": "update-lock-file @netcracker"
2828
},
2929
"dependencies": {
30-
"@netcracker/qubership-apihub-api-unifier": "dev",
30+
"@netcracker/qubership-apihub-api-unifier": "feature-pathItems",
3131
"@netcracker/qubership-apihub-json-crawl": "1.0.4",
3232
"fast-equals": "4.0.3"
3333
},
3434
"devDependencies": {
35-
"@netcracker/qubership-apihub-compatibility-suites": "dev",
35+
"@netcracker/qubership-apihub-compatibility-suites": "feature-pathItems",
3636
"@netcracker/qubership-apihub-graphapi": "1.0.8",
3737
"@netcracker/qubership-apihub-npm-gitflow": "3.1.0",
3838
"@types/jest": "29.5.11",
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { compareFiles } from '../utils'
2+
import { diffsMatcher } from '../../helper/matchers'
3+
import { breaking, DiffAction, nonBreaking } from '../../../src'
4+
5+
const SUITE_ID = 'pathItems'
6+
7+
const PATH_ITEM_PATH = [
8+
'components',
9+
'pathItems',
10+
'UserOps',
11+
]
12+
13+
describe('Openapi3.1 PathItems', () => {
14+
15+
test('Add method in path item', async () => {
16+
const testId = 'add-method-in-pathitem'
17+
const result = await compareFiles(SUITE_ID, testId)
18+
expect(result).toEqual(diffsMatcher([
19+
expect.objectContaining({
20+
action: DiffAction.add,
21+
afterDeclarationPaths: [[...PATH_ITEM_PATH, 'post']],
22+
type: nonBreaking,
23+
}),
24+
]))
25+
})
26+
27+
test('Add unused method in path item', async () => {
28+
const testId = 'add-unused-method-in-pathitem'
29+
const result = await compareFiles(SUITE_ID, testId)
30+
expect(result).toEqual([])
31+
})
32+
33+
test('Remove method in path item', async () => {
34+
const testId = 'remove-method-in-pathitem'
35+
const result = await compareFiles(SUITE_ID, testId)
36+
expect(result).toEqual(diffsMatcher([
37+
expect.objectContaining({
38+
action: DiffAction.remove,
39+
beforeDeclarationPaths: [[...PATH_ITEM_PATH, 'post']],
40+
type: breaking,
41+
}),
42+
]))
43+
})
44+
45+
test('Replace inline path item to ref', async () => {
46+
const testId = 'replace-inline-pathitem-to-ref'
47+
const result = await compareFiles(SUITE_ID, testId)
48+
expect(result).toEqual([])
49+
})
50+
51+
test('Replace ref path item to inline', async () => {
52+
const testId = 'replace-ref-pathitem-to-inline'
53+
const result = await compareFiles(SUITE_ID, testId)
54+
expect(result).toEqual([])
55+
})
56+
})

0 commit comments

Comments
 (0)