Skip to content

Commit 0b037c2

Browse files
Add more test cases
1 parent 10faa72 commit 0b037c2

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

tools/spectral/ipa/__tests__/createMethodShouldNotHaveQueryParameters.test.js

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,22 @@ const componentSchemas = {
77
type: 'object',
88
},
99
},
10+
parameters: {
11+
QueryParam: {
12+
name: 'query-param',
13+
in: 'query',
14+
schema: {
15+
type: 'string'
16+
},
17+
},
18+
PathParam: {
19+
name: 'resource-id',
20+
in: 'path',
21+
schema: {
22+
type: 'string'
23+
},
24+
}
25+
}
1026
};
1127

1228
testRule('xgen-IPA-106-create-method-should-not-have-query-parameters', [
@@ -30,6 +46,9 @@ testRule('xgen-IPA-106-create-method-should-not-have-query-parameters', [
3046
$ref: '#/components/schemas/Schema',
3147
},
3248
},
49+
{
50+
$ref: '#/components/parameters/PathParam',
51+
}
3352
],
3453
},
3554
},
@@ -67,12 +86,8 @@ testRule('xgen-IPA-106-create-method-should-not-have-query-parameters', [
6786
schema: { type: 'string' },
6887
},
6988
{
70-
name: 'query-param',
71-
in: 'query',
72-
schema: {
73-
$ref: '#/components/schemas/Schema',
74-
},
75-
},
89+
$ref: '#/components/parameters/QueryParam',
90+
}
7691
],
7792
},
7893
},
@@ -116,12 +131,8 @@ testRule('xgen-IPA-106-create-method-should-not-have-query-parameters', [
116131
post: {
117132
parameters: [
118133
{
119-
name: 'query-param',
120-
in: 'query',
121-
schema: {
122-
$ref: '#/components/schemas/Schema',
123-
},
124-
},
134+
$ref: '#/components/parameters/QueryParam',
135+
}
125136
],
126137
'x-xgen-IPA-exception': {
127138
'xgen-IPA-106-create-method-should-not-have-query-parameters': 'Reason',

0 commit comments

Comments
 (0)