From d394a4d3d119bca2bebd825f635f483ce61a507c Mon Sep 17 00:00:00 2001 From: Seyi Adebajo Date: Thu, 13 Sep 2018 10:44:51 -0700 Subject: [PATCH] removes recency test for compliance annotation suggestions. removes related tests on suggestion modification time and last seen interval --- .../app/constants/dataset-compliance.ts | 18 ------------------ .../app/constants/metadata-acquisition.ts | 13 ++----------- .../unit/constants/dataset-compliance-test.js | 15 --------------- .../datasets/metadata-acquisition-test.js | 11 +---------- 4 files changed, 3 insertions(+), 54 deletions(-) diff --git a/wherehows-web/app/constants/dataset-compliance.ts b/wherehows-web/app/constants/dataset-compliance.ts index 599343d0c8..649143e1eb 100644 --- a/wherehows-web/app/constants/dataset-compliance.ts +++ b/wherehows-web/app/constants/dataset-compliance.ts @@ -8,7 +8,6 @@ import { import { IComplianceDataType } from 'wherehows-web/typings/api/list/compliance-datatypes'; import { arrayEvery, arrayFilter, arrayMap, arrayReduce, arraySome, reduceArrayAsync } from 'wherehows-web/utils/array'; import { omit, hasEnumerableKeys } from 'wherehows-web/utils/object'; -import { lastSeenSuggestionInterval } from 'wherehows-web/constants/metadata-acquisition'; import { decodeUrn, isValidCustomValuePattern } from 'wherehows-web/utils/validators/urn'; import { IComplianceChangeSet, @@ -172,22 +171,6 @@ const isAutoGeneratedPolicy = (policy?: IComplianceInfo): boolean => { const getIdTypeDataTypes = (complianceDataTypes: Array = []): Array => complianceDataTypes.filter(complianceDataType => complianceDataType.idType).mapBy('id'); -/** - * Checks if the compliance suggestion has a date that is equal or exceeds the policy mod time by at least the - * ms time in lastSeenSuggestionInterval - * @param {IComplianceInfo.modifiedTime} policyModificationTime timestamp for the policy modification date - * @param {number} suggestionModificationTime timestamp for the suggestion modification date - * @return {boolean} - */ -const isRecentSuggestion = ( - policyModificationTime: IComplianceInfo['modifiedTime'], - suggestionModificationTime: number -): boolean => - // policy has not been modified previously or suggestion mod time is greater than or equal to interval - !policyModificationTime || - (!!suggestionModificationTime && - suggestionModificationTime - parseInt(policyModificationTime) >= lastSeenSuggestionInterval); - /** * Takes a suggestion and populates a list of ComplianceFieldIdValues if the suggestion matches the identifier * @param {ISuggestedFieldTypeValues | void} suggestion @@ -693,7 +676,6 @@ export { tagSuggestionNeedsReview, isTagIdType, mergeComplianceEntitiesWithSuggestions, - isRecentSuggestion, tagsRequiringReview, tagsHaveNoneType, fieldTagsRequiringReview, diff --git a/wherehows-web/app/constants/metadata-acquisition.ts b/wherehows-web/app/constants/metadata-acquisition.ts index 7d70386324..cd23aa40b5 100644 --- a/wherehows-web/app/constants/metadata-acquisition.ts +++ b/wherehows-web/app/constants/metadata-acquisition.ts @@ -3,14 +3,6 @@ import { IComplianceDataType } from 'wherehows-web/typings/api/list/compliance-d import { formatAsCapitalizedStringWithSpaces } from 'wherehows-web/utils/helpers/string'; import { IComplianceChangeSet, ISecurityClassificationOption } from 'wherehows-web/typings/app/dataset-compliance'; -/** - * Length of time between suggestion modification time and last modified time for the compliance policy - * If a policy has been updated within the range of this window then it is considered as stale / or - * has been seen previously - * @type {number} - */ -const lastSeenSuggestionInterval: number = 7 * 24 * 60 * 60 * 1000; - /** * Percentage value for a compliance policy suggestion with a low confidence score * @type {number} @@ -65,8 +57,8 @@ const isCustomId = (identifierType: string) => identifierType === ComplianceFiel * Caches a list of fieldIdentifierTypes values * @type {Array} */ -const fieldIdentifierTypeValues: Array = >Object.values( - ComplianceFieldIdValue +const fieldIdentifierTypeValues: Array = >( + Object.values(ComplianceFieldIdValue) ); /** @@ -89,7 +81,6 @@ export { fieldIdentifierTypeValues, isMixedId, isCustomId, - lastSeenSuggestionInterval, lowQualitySuggestionConfidenceThreshold, getDefaultSecurityClassification }; diff --git a/wherehows-web/tests/unit/constants/dataset-compliance-test.js b/wherehows-web/tests/unit/constants/dataset-compliance-test.js index d7a326ac30..1e6f6c9e9d 100644 --- a/wherehows-web/tests/unit/constants/dataset-compliance-test.js +++ b/wherehows-web/tests/unit/constants/dataset-compliance-test.js @@ -7,7 +7,6 @@ import { isAutoGeneratedPolicy, PurgePolicy, initialComplianceObjectFactory, - isRecentSuggestion, tagNeedsReview, lowQualitySuggestionConfidenceThreshold } from 'wherehows-web/constants'; @@ -43,20 +42,6 @@ module('Unit | Constants | dataset compliance', function() { ); }); - test('isRecentSuggestion exists', function(assert) { - assert.expect(1); - assert.ok(typeof isRecentSuggestion === 'function', 'isRecentSuggestion is a function'); - }); - - test('isRecentSuggestion correctly determines if a suggestion is recent or not', function(assert) { - assert.expect(mockTimeStamps.length); - - mockTimeStamps.forEach(({ policyModificationTime, suggestionModificationTime, __isRecent__, __assertMsg__ }) => { - const recent = isRecentSuggestion(policyModificationTime, suggestionModificationTime); - assert.ok(recent === __isRecent__, `${__assertMsg__} isRecent? ${recent}`); - }); - }); - test('tagNeedsReview exists', function(assert) { assert.ok(typeof tagNeedsReview === 'function', 'tagNeedsReview is a function'); diff --git a/wherehows-web/tests/unit/utils/datasets/metadata-acquisition-test.js b/wherehows-web/tests/unit/utils/datasets/metadata-acquisition-test.js index 7f4fa5600d..a85c90f9ad 100644 --- a/wherehows-web/tests/unit/utils/datasets/metadata-acquisition-test.js +++ b/wherehows-web/tests/unit/utils/datasets/metadata-acquisition-test.js @@ -1,16 +1,7 @@ -import { - lastSeenSuggestionInterval, - lowQualitySuggestionConfidenceThreshold -} from 'wherehows-web/constants/metadata-acquisition'; +import { lowQualitySuggestionConfidenceThreshold } from 'wherehows-web/constants/metadata-acquisition'; import { formatAsCapitalizedStringWithSpaces } from 'wherehows-web/utils/helpers/string'; import { module, test } from 'qunit'; -module('Unit | Utility | datasets/metadata acquisition', function() { - test('lastSeenSuggestionInterval is a number', function(assert) { - assert.ok(typeof lastSeenSuggestionInterval === 'number'); - }); -}); - module('Unit | Utility | datasets/metadata acquisition', function() { test('lowQualitySuggestionConfidenceThreshold is a number', function(assert) { assert.ok(typeof lowQualitySuggestionConfidenceThreshold === 'number');