Skip to content

Commit 0fb4b4e

Browse files
committed
feat: Refactoring and added new test
1 parent 32ae238 commit 0fb4b4e

File tree

2 files changed

+56
-56
lines changed

2 files changed

+56
-56
lines changed

test/compatibility-suites/openapi/general-operation-parameters.test.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,3 +767,59 @@ describe('Openapi3 General Operation Parameters', () => {
767767
]))
768768
})
769769
})
770+
771+
const PATH_ITEM_PATH = [
772+
'components',
773+
'pathItems',
774+
'UserOps',
775+
]
776+
777+
describe('Openapi3.1 PathItems', () => {
778+
test('Add method in path item', async () => {
779+
const testId = 'add-method-in-path-item'
780+
const result = await compareFiles(SUITE_ID, testId)
781+
expect(result).toEqual(diffsMatcher([
782+
expect.objectContaining({
783+
action: DiffAction.add,
784+
afterDeclarationPaths: [[...PATH_ITEM_PATH, 'post']],
785+
type: nonBreaking,
786+
}),
787+
]))
788+
})
789+
790+
test('Remove unused method in path item', async () => {
791+
const testId = 'remove-unused-method-in-path-item'
792+
const result = await compareFiles(SUITE_ID, testId)
793+
expect(result).toEqual([])
794+
})
795+
796+
test('Add unused method in path item', async () => {
797+
const testId = 'add-unused-method-in-path-item'
798+
const result = await compareFiles(SUITE_ID, testId)
799+
expect(result).toEqual([])
800+
})
801+
802+
test('Remove method in path item', async () => {
803+
const testId = 'remove-method-in-path-item'
804+
const result = await compareFiles(SUITE_ID, testId)
805+
expect(result).toEqual(diffsMatcher([
806+
expect.objectContaining({
807+
action: DiffAction.remove,
808+
beforeDeclarationPaths: [[...PATH_ITEM_PATH, 'post']],
809+
type: breaking,
810+
}),
811+
]))
812+
})
813+
814+
test('Replace inline path item to ref', async () => {
815+
const testId = 'replace-inline-path-item-to-ref'
816+
const result = await compareFiles(SUITE_ID, testId)
817+
expect(result).toEqual([])
818+
})
819+
820+
test('Replace ref path item to inline', async () => {
821+
const testId = 'replace-ref-path-item-to-inline'
822+
const result = await compareFiles(SUITE_ID, testId)
823+
expect(result).toEqual([])
824+
})
825+
})

test/compatibility-suites/openapi/path-item.test.ts

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)