Skip to content

Commit 42469fe

Browse files
fix
1 parent d6af94f commit 42469fe

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

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

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ testRule('xgen-IPA-104-GET-response-code-should-be-200-OK', [
66
name: 'valid methods',
77
document: {
88
paths: {
9-
'/path1/{resource}': {
9+
'/resource': {
1010
get: {
1111
responses: {
1212
200: {},
@@ -15,12 +15,30 @@ testRule('xgen-IPA-104-GET-response-code-should-be-200-OK', [
1515
},
1616
},
1717
},
18-
'/path2/{resource}': {
18+
'/resource/{id}': {
1919
get: {
2020
responses: {
2121
200: {},
22-
401: {},
23-
404: {},
22+
400: {},
23+
500: {},
24+
},
25+
},
26+
},
27+
'/resource/{id}:customMethod': {
28+
get: {
29+
responses: {
30+
200: {},
31+
400: {},
32+
500: {},
33+
},
34+
},
35+
},
36+
'/singleton': {
37+
get: {
38+
responses: {
39+
200: {},
40+
400: {},
41+
500: {},
2442
},
2543
},
2644
},
@@ -32,7 +50,7 @@ testRule('xgen-IPA-104-GET-response-code-should-be-200-OK', [
3250
name: 'invalid methods',
3351
document: {
3452
paths: {
35-
'/path1/{resource}': {
53+
'/resource1/{id}': {
3654
get: {
3755
responses: {
3856
201: {},
@@ -41,7 +59,7 @@ testRule('xgen-IPA-104-GET-response-code-should-be-200-OK', [
4159
},
4260
},
4361
},
44-
'/path2/{resource}': {
62+
'/resource2/{id}': {
4563
get: {
4664
responses: {
4765
400: {},
@@ -55,13 +73,13 @@ testRule('xgen-IPA-104-GET-response-code-should-be-200-OK', [
5573
{
5674
code: 'xgen-IPA-104-GET-response-code-should-be-200-OK',
5775
message: 'The HTTP response status code for GET operations should be 200 OK. http://go/ipa/104',
58-
path: ['paths', '/path1/{resource}', 'get'],
76+
path: ['paths', '/resource1/{id}', 'get'],
5977
severity: DiagnosticSeverity.Warning,
6078
},
6179
{
6280
code: 'xgen-IPA-104-GET-response-code-should-be-200-OK',
6381
message: 'The HTTP response status code for GET operations should be 200 OK. http://go/ipa/104',
64-
path: ['paths', '/path2/{resource}', 'get'],
82+
path: ['paths', '/resource2/{id}', 'get'],
6583
severity: DiagnosticSeverity.Warning,
6684
},
6785
],
@@ -70,7 +88,7 @@ testRule('xgen-IPA-104-GET-response-code-should-be-200-OK', [
7088
name: 'invalid method with exception',
7189
document: {
7290
paths: {
73-
'/path1/{resource}': {
91+
'/resource1/{id}': {
7492
get: {
7593
responses: {
7694
201: {},
@@ -82,7 +100,7 @@ testRule('xgen-IPA-104-GET-response-code-should-be-200-OK', [
82100
},
83101
},
84102
},
85-
'/path2/{resource}': {
103+
'/resource2/{id}': {
86104
get: {
87105
responses: {
88106
400: {},

0 commit comments

Comments
 (0)