Skip to content

Commit 6c2f9fc

Browse files
author
Sophia Marie Terry
committed
CLOUDP-306294: silenced opIdgeneration tests + prettier
1 parent 1c864be commit 6c2f9fc

File tree

5 files changed

+29
-24
lines changed

5 files changed

+29
-24
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"testPathIgnorePatterns": [
2121
"__helpers__",
2222
"metrics/data",
23-
"IPA\\d+ValidOperationID\\.test\\.js$"
23+
"IPA\\d+ValidOperationID\\.test\\.js$",
24+
"operationIdGeneration.test.js"
2425
]
2526
},
2627
"dependencies": {

tools/spectral/ipa/__tests__/utils/extensions.test.js

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
import { describe, it, expect, toBe } from '@jest/globals';
2-
import { hasMethodWithVerbOverride, hasCustomMethodOverride, hasMethodVerbOverride } from '../../rulesets/functions/utils/extensions';
2+
import {
3+
hasMethodWithVerbOverride,
4+
hasCustomMethodOverride,
5+
hasMethodVerbOverride,
6+
} from '../../rulesets/functions/utils/extensions';
37

48
const methodWithExtension = {
5-
'x-xgen-method-verb-override': {
6-
verb: 'get',
7-
customMethod: false,
8-
},
9+
'x-xgen-method-verb-override': {
10+
verb: 'get',
11+
customMethod: false,
12+
},
913
};
1014

1115
const customMethod = {
12-
'x-xgen-method-verb-override': {
13-
verb: 'add',
14-
customMethod: true,
15-
},
16-
}
16+
'x-xgen-method-verb-override': {
17+
verb: 'add',
18+
customMethod: true,
19+
},
20+
};
1721

1822
const endpointWithMethodExtension = {
1923
delete: {
20-
'x-xgen-method-verb-override': { verb: '‘remove’', customMethod: true }
21-
}
24+
'x-xgen-method-verb-override': { verb: '‘remove’', customMethod: true },
25+
},
2226
};
2327

2428
const endpointWithNoMethodExtension = {
25-
'exception' : true
29+
exception: true,
2630
};
2731

2832
describe('tools/spectral/ipa/rulesets/functions/utils/extensions.js', () => {
@@ -53,13 +57,13 @@ describe('tools/spectral/ipa/rulesets/functions/utils/extensions.js', () => {
5357
describe('tools/spectral/ipa/rulesets/functions/utils/extensions.js', () => {
5458
describe('hasMethodVerbOverride', () => {
5559
it('returns true if the method has the extension with the expected verb', () => {
56-
expect(hasMethodVerbOverride(methodWithExtension, "get")).toBe(true);
60+
expect(hasMethodVerbOverride(methodWithExtension, 'get')).toBe(true);
5761
});
5862
it('returns false if the method does not have the extension', () => {
59-
expect(hasMethodVerbOverride({}, "get")).toBe(false);
63+
expect(hasMethodVerbOverride({}, 'get')).toBe(false);
6064
});
6165
it('returns false if the method has the extension but with an unexpected verb', () => {
62-
expect(hasMethodVerbOverride(methodWithExtension, "put")).toBe(false);
66+
expect(hasMethodVerbOverride(methodWithExtension, 'put')).toBe(false);
6367
});
6468
});
6569
});

tools/spectral/ipa/rulesets/functions/IPA104ValidOperationID.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default (input, { methodName }, { path, documentInventory }) => {
1616
if (
1717
hasCustomMethodOverride(input) ||
1818
isCustomMethodIdentifier(resourcePath) ||
19-
hasMethodVerbOverride(input, "list") ||
19+
hasMethodVerbOverride(input, 'list') ||
2020
(invalidGetMethod(resourcePath, resourcePaths) && !hasMethodVerbOverride(input, methodName))
2121
) {
2222
return;

tools/spectral/ipa/rulesets/functions/utils/extensions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ export const VERB_OVERRIDE_EXTENSION = 'x-xgen-method-verb-override';
33
/**
44
* Checks if the endpoint has a method with an extension "x-xgen-method-verb-override"
55
*
6-
* @param object the object to evaluate
7-
* @returns {boolean} true if the object has the extension, otherwise false
6+
* @param endpoint the endpoint to evaluate
7+
* @returns {boolean} true if the endpoint has a nested method with the extension, otherwise false
88
*/
99
export function hasMethodWithVerbOverride(endpoint) {
1010
const keys = Object.keys(endpoint);
@@ -54,4 +54,4 @@ function hasVerbOverride(object) {
5454
return false;
5555
}
5656
return true;
57-
}
57+
}

tools/spectral/ipa/rulesets/functions/utils/methodLogic.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { isPathParam } from './resourceEvaluation';
33

44
/**
55
* Checks whether the get method at a given path is valid
6-
*
6+
*
77
* @param resourcePath the resource path to inspect
88
* @param resourcePaths the resource paths generated by getResourcePathItems
99
* @returns true if the resourcePath has an invalid list method, false otherwise
@@ -17,7 +17,7 @@ export function invalidGetMethod(resourcePath, resourcePaths) {
1717

1818
/**
1919
* Checks whether the list method at a given path is valid
20-
*
20+
*
2121
* @param resourcePath the resource path to inspect
2222
* @param resourcePaths the resource paths generated by getResourcePathItems
2323
* @returns true if the resourcePath has an invalid list method, false otherwise
@@ -31,4 +31,4 @@ function lastIdentifierIsPathParam(resourceIdentifier) {
3131
resourceIdentifier = resourceIdentifier.substring(0, resourceIdentifier.lastIndexOf('.'));
3232
}
3333
return isPathParam(resourceIdentifier.split('/').pop());
34-
}
34+
}

0 commit comments

Comments
 (0)