Skip to content

Commit 25b1e30

Browse files
author
Sophia Marie Terry
committed
IPA 109 tests for overrides
1 parent 1bf015f commit 25b1e30

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

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

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,60 @@ testRule('xgen-IPA-109-valid-operation-id', [
6767
},
6868
],
6969
},
70+
{
71+
name: 'valid methods with valid overrides',
72+
document: {
73+
paths: {
74+
'/api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}': {
75+
delete: {
76+
operationId: 'removeFederationSettingConnectedOrgConfig',
77+
'x-xgen-method-verb-override': { verb: 'remove', customMethod: true },
78+
'x-xgen-operation-id-override': 'removeConnectedOrgConfig',
79+
},
80+
},
81+
},
82+
},
83+
errors: [],
84+
},
85+
{
86+
name: 'valid methods with invalid overrides',
87+
document: {
88+
paths: {
89+
'/api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}': {
90+
delete: {
91+
operationId: 'removeFederationSettingConnectedOrgConfig',
92+
'x-xgen-method-verb-override': { verb: 'remove', customMethod: true },
93+
'x-xgen-operation-id-override': 'removeOrgConfigTest',
94+
},
95+
},
96+
},
97+
},
98+
errors: [
99+
{
100+
code: 'xgen-IPA-109-valid-operation-id',
101+
message:
102+
"The operation ID override must only contain nouns from the operation ID 'removeFederationSettingConnectedOrgConfig'. ",
103+
path: [
104+
'paths',
105+
'/api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}',
106+
'delete',
107+
'x-xgen-operation-id-override',
108+
],
109+
severity: DiagnosticSeverity.Warning,
110+
},
111+
{
112+
code: 'xgen-IPA-109-valid-operation-id',
113+
message: "The operation ID override must end with the noun 'Config'. ",
114+
path: [
115+
'paths',
116+
'/api/atlas/v2/federationSettings/{federationSettingsId}/connectedOrgConfigs/{orgId}',
117+
'delete',
118+
'x-xgen-operation-id-override',
119+
],
120+
severity: DiagnosticSeverity.Warning,
121+
},
122+
],
123+
},
70124
{
71125
name: 'invalid methods with exceptions',
72126
document: {

0 commit comments

Comments
 (0)