mirror of
				https://github.com/datahub-project/datahub.git
				synced 2025-10-31 02:37:05 +00:00 
			
		
		
		
	removes recency test for compliance annotation suggestions. removes related tests on suggestion modification time and last seen interval
This commit is contained in:
		
							parent
							
								
									be22fcfb90
								
							
						
					
					
						commit
						d394a4d3d1
					
				| @ -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<IComplianceDataType> = []): Array<string> => | ||||
|   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, | ||||
|  | ||||
| @ -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<ComplianceFieldIdValue>} | ||||
|  */ | ||||
| const fieldIdentifierTypeValues: Array<ComplianceFieldIdValue> = <Array<ComplianceFieldIdValue>>Object.values( | ||||
|   ComplianceFieldIdValue | ||||
| const fieldIdentifierTypeValues: Array<ComplianceFieldIdValue> = <Array<ComplianceFieldIdValue>>( | ||||
|   Object.values(ComplianceFieldIdValue) | ||||
| ); | ||||
| 
 | ||||
| /** | ||||
| @ -89,7 +81,6 @@ export { | ||||
|   fieldIdentifierTypeValues, | ||||
|   isMixedId, | ||||
|   isCustomId, | ||||
|   lastSeenSuggestionInterval, | ||||
|   lowQualitySuggestionConfidenceThreshold, | ||||
|   getDefaultSecurityClassification | ||||
| }; | ||||
|  | ||||
| @ -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'); | ||||
| 
 | ||||
|  | ||||
| @ -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'); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Seyi Adebajo
						Seyi Adebajo