diff --git a/lib/core/decision_service/cmab/cmab_service.spec.ts b/lib/core/decision_service/cmab/cmab_service.spec.ts index 38ee205e4..fa3c3615f 100644 --- a/lib/core/decision_service/cmab/cmab_service.spec.ts +++ b/lib/core/decision_service/cmab/cmab_service.spec.ts @@ -96,8 +96,8 @@ describe('DefaultCmabService', () => { expect(ruleIdArg).toEqual(ruleId); expect(userIdArg).toEqual(userContext.getUserId()); expect(attributesArg).toEqual({ - country: 'US', - age: '25', + '66': 'US', + '77': '25', }); }); @@ -124,13 +124,13 @@ describe('DefaultCmabService', () => { expect(mockCmabClient.fetchDecision).toHaveBeenCalledTimes(2); expect(mockCmabClient.fetchDecision.mock.calls[0][2]).toEqual({ - country: 'US', - age: '25', - language: 'en', + '66': 'US', + '77': '25', + '88': 'en', }); expect(mockCmabClient.fetchDecision.mock.calls[1][2]).toEqual({ - country: 'US', - gender: 'male' + '66': 'US', + '99': 'male' }); }); diff --git a/lib/core/decision_service/cmab/cmab_service.ts b/lib/core/decision_service/cmab/cmab_service.ts index 004a146c0..2e613b4fd 100644 --- a/lib/core/decision_service/cmab/cmab_service.ts +++ b/lib/core/decision_service/cmab/cmab_service.ts @@ -182,9 +182,9 @@ export class DefaultCmabService implements CmabService { cmabAttributeIds.forEach((aid) => { const attribute = projectConfig.attributeIdMap[aid]; - + if (userAttributes.hasOwnProperty(attribute.key)) { - filteredAttributes[attribute.key] = userAttributes[attribute.key]; + filteredAttributes[aid] = userAttributes[attribute.key]; } });