Skip to content

Commit eca80ae

Browse files
author
Sophia Marie Terry
committed
renamed utils and enabled opID unit tests
1 parent c1dff45 commit eca80ae

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

package.json

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

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { collectAdoption, collectAndReturnViolation, collectException } from './
33
import { hasException } from './utils/exceptions.js';
44
import { getResourcePathItems, isCustomMethodIdentifier } from './utils/resourceEvaluation.js';
55
import { hasCustomMethodOverride, hasMethodVerbOverride } from './utils/extensions.js';
6-
import { invalidGetMethod } from './utils/methodLogic.js';
6+
import { isInvalidGetMethod } from './utils/methodLogic.js';
77

88
const RULE_NAME = 'xgen-IPA-104-valid-operation-id';
99
const ERROR_MESSAGE = 'Invalid OperationID.';
@@ -17,7 +17,7 @@ export default (input, { methodName }, { path, documentInventory }) => {
1717
hasCustomMethodOverride(input) ||
1818
isCustomMethodIdentifier(resourcePath) ||
1919
hasMethodVerbOverride(input, 'list') ||
20-
(invalidGetMethod(resourcePath, resourcePaths) && !hasMethodVerbOverride(input, methodName))
20+
(isInvalidGetMethod(resourcePath, resourcePaths) && !hasMethodVerbOverride(input, methodName))
2121
) {
2222
return;
2323
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { hasException } from './utils/exceptions.js';
22
import { collectAdoption, collectAndReturnViolation, collectException } from './utils/collectionUtils.js';
33
import { getResourcePathItems, isCustomMethodIdentifier } from './utils/resourceEvaluation.js';
44
import { generateOperationID } from './utils/operationIdGeneration.js';
5-
import { invalidListMethod } from './utils/methodLogic.js';
5+
import { isInvalidListMethod } from './utils/methodLogic.js';
66
import { hasCustomMethodOverride, hasMethodVerbOverride } from './utils/extensions.js';
77

88
const RULE_NAME = 'xgen-IPA-105-valid-operation-id';
@@ -17,7 +17,7 @@ export default (input, { methodName }, { path, documentInventory }) => {
1717
hasCustomMethodOverride(input) ||
1818
isCustomMethodIdentifier(resourcePath) ||
1919
hasMethodVerbOverride(input, 'get') ||
20-
(invalidListMethod(resourcePath, resourcePaths) && !hasMethodVerbOverride(input, methodName))
20+
(isInvalidListMethod(resourcePath, resourcePaths) && !hasMethodVerbOverride(input, methodName))
2121
) {
2222
return;
2323
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { isPathParam } from './resourceEvaluation.js';
88
* @param resourcePaths the resource paths generated by getResourcePathItems
99
* @returns true if the resourcePath has an invalid get method, false otherwise
1010
*/
11-
export function invalidGetMethod(resourcePath, resourcePaths) {
11+
export function isInvalidGetMethod(resourcePath, resourcePaths) {
1212
return (
1313
!lastIdentifierIsPathParam(resourcePath) &&
1414
!(isResourceCollectionIdentifier(resourcePath) && isSingletonResource(resourcePaths))
@@ -22,7 +22,7 @@ export function invalidGetMethod(resourcePath, resourcePaths) {
2222
* @param resourcePaths the resource paths generated by getResourcePathItems
2323
* @returns true if the resourcePath has an invalid list method, false otherwise
2424
*/
25-
export function invalidListMethod(resourcePath, resourcePaths) {
25+
export function isInvalidListMethod(resourcePath, resourcePaths) {
2626
return lastIdentifierIsPathParam(resourcePath) || isSingletonResource(resourcePaths);
2727
}
2828

0 commit comments

Comments
 (0)