mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-12 18:47:45 +00:00
unit tests isAutoGeneratedPolicy
This commit is contained in:
parent
1eb4cb83a0
commit
34a537a1af
@ -3,7 +3,9 @@ import {
|
||||
getComplianceSteps,
|
||||
complianceSteps,
|
||||
getFieldIdentifierOption,
|
||||
getFieldIdentifierOptions
|
||||
getFieldIdentifierOptions,
|
||||
isAutoGeneratedPolicy,
|
||||
PurgePolicy
|
||||
} from 'wherehows-web/constants';
|
||||
import complianceDataTypes from 'wherehows-web/mirage/fixtures/compliance-data-types';
|
||||
|
||||
@ -50,3 +52,29 @@ test('getFieldIdentifierOptions function should behave as expected', function(as
|
||||
assert.ok(result.value === complianceDataTypes[index].id, 'id matches the resulting value');
|
||||
});
|
||||
});
|
||||
|
||||
test('isAutoGeneratedPolicy function correctly determines if a policy is auto-generated', function(assert) {
|
||||
let result = isAutoGeneratedPolicy();
|
||||
|
||||
assert.ok(result === false, 'expected return value of false when no arguments are supplied');
|
||||
|
||||
result = isAutoGeneratedPolicy({
|
||||
complianceType: PurgePolicy.AutoPurge,
|
||||
complianceEntities: []
|
||||
});
|
||||
|
||||
assert.ok(
|
||||
result,
|
||||
'expected return to be truthy when complianceEntities are empty and complianceType is a PurgePolicy'
|
||||
);
|
||||
|
||||
result = isAutoGeneratedPolicy({
|
||||
complianceType: PurgePolicy.AutoPurge,
|
||||
complianceEntities: [1]
|
||||
});
|
||||
|
||||
assert.notOk(
|
||||
result,
|
||||
'expected return to be falsey when complianceEntities are not empty and complianceType is a PurgePolicy'
|
||||
);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user