Browse Source

Add tests for the new option in getDataValue for conditions ( skipDynamicValueResolution )

pull/6419/head
mohamedsalem401 2 years ago
parent
commit
215ade0be0
  1. 18
      packages/core/test/specs/data_sources/model/conditional_variables/DataCondition.ts

18
packages/core/test/specs/data_sources/model/conditional_variables/DataCondition.ts

@ -47,6 +47,24 @@ describe('DataCondition', () => {
expect(dataCondition.getDataValue()).toBe('No');
});
test('should return raw ifTrue value when skipDynamicValueResolution is true and condition is true', () => {
const condition = true;
const ifTrue = { type: DataVariableType, path: 'USER_STATUS_SOURCE.USER_1.status' };
const ifFalse = 'No';
const dataCondition = new DataCondition({ condition, ifTrue, ifFalse }, { em });
expect(dataCondition.getDataValue(true)).toEqual(ifTrue);
});
test('should return raw ifFalse value when skipDynamicValueResolution is true and condition is false', () => {
const condition = false;
const ifTrue = 'Yes';
const ifFalse = { type: DataVariableType, path: 'USER_STATUS_SOURCE.USER_1.status' };
const dataCondition = new DataCondition({ condition, ifTrue, ifFalse }, { em });
expect(dataCondition.getDataValue(true)).toEqual(ifFalse);
});
});
describe('Operator Tests', () => {

Loading…
Cancel
Save