Skip to content

Commit 1af80ce

Browse files
committed
fix: add pahth parameter rename test for prefix groups
1 parent a5e0d54 commit 1af80ce

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

test/prefix-groups.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,25 @@ describe('Prefix Groups test', () => {
263263
]))
264264
})
265265

266+
test('Change path parameter name in a new version', async () => {
267+
const result = await buildPrefixGroupChangelogPackage({ packageId: 'prefix-groups/change-path-param-name' })
268+
269+
expect(result).toEqual(changesSummaryMatcher({
270+
[ANNOTATION_CHANGE_TYPE]: 2,
271+
}))
272+
expect(result).toEqual(numberOfImpactedOperationsMatcher({
273+
[ANNOTATION_CHANGE_TYPE]: 1,
274+
}))
275+
276+
//check operation ids
277+
expect(result).toEqual(operationChangesMatcher([
278+
expect.objectContaining({
279+
operationId: 'users-id-posts-get',
280+
previousOperationId: 'users-userid-posts-get',
281+
}),
282+
]))
283+
})
284+
266285
test('should compare prefix groups with different length', async () => {
267286
const result = await buildPrefixGroupChangelogPackage({
268287
packageId: 'prefix-groups/different-prefix-length',
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
openapi: 3.0.3
2+
info:
3+
title: test
4+
version: 0.1.0
5+
paths:
6+
/api/v1/users/{userId}/posts:
7+
get:
8+
operationId: getUserPosts
9+
parameters:
10+
- name: userId
11+
in: path
12+
required: true
13+
schema:
14+
type: string
15+
responses:
16+
'200':
17+
description: OK
18+
content:
19+
application/json:
20+
schema: {}
21+
/api/v2/users/{id}/posts:
22+
get:
23+
operationId: getUserPosts
24+
parameters:
25+
- name: id
26+
in: path
27+
required: true
28+
schema:
29+
type: string
30+
responses:
31+
'200':
32+
description: OK
33+
content:
34+
application/json:
35+
schema: {}

0 commit comments

Comments
 (0)