Skip to content

Commit 035946d

Browse files
author
Sophia Marie Terry
committed
Enable tests
1 parent 427afd7 commit 035946d

File tree

4 files changed

+29
-41
lines changed

4 files changed

+29
-41
lines changed

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

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import testRule from './__helpers__/testRule';
2+
import { DiagnosticSeverity } from '@stoplight/types';
23

34
// TODO: add tests for xgen-custom-method extension - CLOUDP-306294
4-
// TOOD: enable tests for invalid methods (after rules are upgraded to warning) - CLOUDP-329722
55

66
testRule('xgen-IPA-105-valid-operation-id', [
77
{
@@ -17,40 +17,33 @@ testRule('xgen-IPA-105-valid-operation-id', [
1717
},
1818
errors: [],
1919
},
20-
// This test will be enable when the xgen-IPA-105-valid-operation-id is set to warning severity - CLOUDP-329722
21-
/* {
22-
name: 'invalid methods',
20+
{
21+
name: 'invalid methods with too long opIDs',
2322
document: {
2423
paths: {
25-
'/api/atlas/v2/orgs/{orgId}/teams/{teamId}/users': {
26-
get: {
27-
operationId: 'listTeamUsers',
28-
},
29-
},
30-
'/api/atlas/v2/orgs/{orgId}/events': {
24+
'/api/atlas/v2/unauth/controlPlaneIPAddresses': {
3125
get: {
32-
operationId: 'listOrganizationEvents',
26+
operationId: 'returnAllControlPlaneIpAddresses',
3327
},
3428
},
3529
},
3630
},
3731
errors: [
3832
{
3933
code: 'xgen-IPA-105-valid-operation-id',
40-
message:
41-
'Invalid OperationID. ',
42-
path: ['paths', '/api/atlas/v2/groups/{groupId}/databaseUsers/{username}/certs', 'get'],
34+
message: 'Invalid OperationID. ',
35+
path: ['paths', '/api/atlas/v2/unauth/controlPlaneIPAddresses', 'get', 'operationId'],
4336
severity: DiagnosticSeverity.Warning,
4437
},
4538
{
4639
code: 'xgen-IPA-105-valid-operation-id',
4740
message:
48-
'Invalid OperationID. ',
49-
path: ['paths', '/api/atlas/v2/orgs/{orgId}/events', 'get'],
41+
"The Operation ID is longer than 4 words. Please add an 'x-xgen-operation-id-override' extension to the operation with a shorter operation ID. For example: 'listPlaneIPAddresses'. https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-105-valid-operation-id",
42+
path: ['paths', '/api/atlas/v2/unauth/controlPlaneIPAddresses', 'get', 'operationId'],
5043
severity: DiagnosticSeverity.Warning,
5144
},
5245
],
53-
}, */
46+
},
5447
{
5548
name: 'invalid methods with exceptions',
5649
document: {

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import testRule from './__helpers__/testRule';
2+
import { DiagnosticSeverity } from '@stoplight/types';
23

34
// TODO: add tests for xgen-custom-method extension - CLOUDP-306294
4-
// TOOD: enable tests for invalid methods (after rules are upgraded to warning) - CLOUDP-329722
55

66
testRule('xgen-IPA-106-valid-operation-id', [
77
{
@@ -17,8 +17,7 @@ testRule('xgen-IPA-106-valid-operation-id', [
1717
},
1818
errors: [],
1919
},
20-
// This test will be enable when the xgen-IPA-106-valid-operation-id is set to warning severity - CLOUDP-329722
21-
/* {
20+
{
2221
name: 'invalid methods',
2322
document: {
2423
paths: {
@@ -38,19 +37,19 @@ testRule('xgen-IPA-106-valid-operation-id', [
3837
{
3938
code: 'xgen-IPA-106-valid-operation-id',
4039
message:
41-
'Invalid OperationID. ',
42-
path: ['paths', '/api/atlas/v2/groups/{groupId}/access', 'post'],
40+
"Invalid OperationID. Found 'addUserToProject', expected 'createGroupAccess'. https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-106-valid-operation-id",
41+
path: ['paths', '/api/atlas/v2/groups/{groupId}/access', 'post', 'operationId'],
4342
severity: DiagnosticSeverity.Warning,
4443
},
4544
{
4645
code: 'xgen-IPA-106-valid-operation-id',
4746
message:
48-
'Invalid OperationID. ',
49-
path: ['paths', '/api/atlas/v2/groups/{groupId}/invites', 'post'],
47+
"Invalid OperationID. Found 'createProjectInvitation', expected 'createGroupInvite'. https://mdb.link/mongodb-atlas-openapi-validation#xgen-IPA-106-valid-operation-id",
48+
path: ['paths', '/api/atlas/v2/groups/{groupId}/invites', 'post', 'operationId'],
5049
severity: DiagnosticSeverity.Warning,
5150
},
5251
],
53-
}, */
52+
},
5453
{
5554
name: 'invalid methods with exceptions',
5655
document: {

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import testRule from './__helpers__/testRule';
2+
import { DiagnosticSeverity } from '@stoplight/types';
23

34
// TODO: add tests for xgen-custom-method extension - CLOUDP-306294
4-
// TOOD: enable tests for invalid methods (after rules are upgraded to warning) - CLOUDP-329722
55

66
testRule('xgen-IPA-107-valid-operation-id', [
77
{
@@ -22,8 +22,7 @@ testRule('xgen-IPA-107-valid-operation-id', [
2222
},
2323
errors: [],
2424
},
25-
// This test will be enable when the xgen-IPA-107-valid-operation-id is set to warning severity - CLOUDP-329722
26-
/* {
25+
{
2726
name: 'invalid methods',
2827
document: {
2928
paths: {
@@ -42,20 +41,18 @@ testRule('xgen-IPA-107-valid-operation-id', [
4241
errors: [
4342
{
4443
code: 'xgen-IPA-107-valid-operation-id',
45-
message:
46-
'Invalid OperationID. ',
47-
path: ['paths', '/api/atlas/v2/groups/{groupId}/limits/{limitName}', 'patch'],
44+
message: 'Invalid OperationID. ',
45+
path: ['paths', '/api/atlas/v2/groups/{groupId}/limits/{limitName}', 'patch', 'operationId'],
4846
severity: DiagnosticSeverity.Warning,
4947
},
5048
{
5149
code: 'xgen-IPA-107-valid-operation-id',
52-
message:
53-
'Invalid OperationID. ',
54-
path: ['paths', '/api/atlas/v2/groups/{groupId}/settings', 'put'],
50+
message: 'Invalid OperationID. ',
51+
path: ['paths', '/api/atlas/v2/groups/{groupId}/settings', 'put', 'operationId'],
5552
severity: DiagnosticSeverity.Warning,
5653
},
5754
],
58-
}, */
55+
},
5956
{
6057
name: 'invalid methods with exceptions',
6158
document: {

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import testRule from './__helpers__/testRule';
2+
import { DiagnosticSeverity } from '@stoplight/types';
23

34
// TODO: add tests for xgen-custom-method extension - CLOUDP-306294
4-
// TOOD: enable tests for invalid methods (after rules are upgraded to warning) - CLOUDP-329722
55

66
testRule('xgen-IPA-108-valid-operation-id', [
77
{
@@ -17,8 +17,7 @@ testRule('xgen-IPA-108-valid-operation-id', [
1717
},
1818
errors: [],
1919
},
20-
// This test will be enable when the xgen-IPA-108-valid-operation-id is set to warning severity - CLOUDP-329722
21-
/* {
20+
{
2221
name: 'invalid methods',
2322
document: {
2423
paths: {
@@ -38,17 +37,17 @@ testRule('xgen-IPA-108-valid-operation-id', [
3837
{
3938
code: 'xgen-IPA-108-valid-operation-id',
4039
message: 'Invalid OperationID. ',
41-
path: ['paths', '/api/atlas/v2/groups/{groupId}/apiKeys/{apiUserId}', 'delete'],
40+
path: ['paths', '/api/atlas/v2/groups/{groupId}/apiKeys/{apiUserId}', 'delete', 'operationId'],
4241
severity: DiagnosticSeverity.Warning,
4342
},
4443
{
4544
code: 'xgen-IPA-108-valid-operation-id',
4645
message: 'Invalid OperationID. ',
47-
path: ['paths', '/api/atlas/v2/groups/{groupId}', 'delete'],
46+
path: ['paths', '/api/atlas/v2/groups/{groupId}', 'delete', 'operationId'],
4847
severity: DiagnosticSeverity.Warning,
4948
},
5049
],
51-
}, */
50+
},
5251
{
5352
name: 'invalid methods with exceptions',
5453
document: {

0 commit comments

Comments
 (0)