Skip to content

Commit 4df8048

Browse files
committed
test: cover denylisted identity attributes
1 parent 70285bf commit 4df8048

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

src/Rokt-Kit.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,12 +1272,9 @@ class RoktKit implements KitInterface {
12721272
}
12731273

12741274
public setUserAttribute(key: string, value: unknown): string {
1275-
if (isSelectPlacementsAttributePersistenceDenied(key)) {
1276-
this.userAttributes = removeSelectPlacementsAttributePersistenceDeniedAttributes(this.userAttributes);
1277-
return 'Successfully set user attribute for forwarder: ' + name;
1275+
if (!isSelectPlacementsAttributePersistenceDenied(key)) {
1276+
this.userAttributes[key] = value;
12781277
}
1279-
1280-
this.userAttributes[key] = value;
12811278
return 'Successfully set user attribute for forwarder: ' + name;
12821279
}
12831280

test/src/tests.spec.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3106,6 +3106,29 @@ describe('Rokt Forwarder', () => {
31063106
});
31073107
expect((window as any).mParticle.forwarder.filters.filteredUser.getMPID()).toBe('123');
31083108
});
3109+
3110+
it('should not cache denylisted commerce attributes from the filtered user', () => {
3111+
(window as any).mParticle.forwarder.onUserIdentified({
3112+
getAllUserAttributes: function () {
3113+
return {
3114+
confirmationRef: 'previous-order',
3115+
currency: 'USD',
3116+
paymentServiceProvider: 'test-provider',
3117+
'test-attribute': 'test-value',
3118+
};
3119+
},
3120+
getMPID: function () {
3121+
return '123';
3122+
},
3123+
getUserIdentities: function () {
3124+
return { userIdentities: {} };
3125+
},
3126+
});
3127+
3128+
expect((window as any).mParticle.forwarder.userAttributes).toEqual({
3129+
'test-attribute': 'test-value',
3130+
});
3131+
});
31093132
});
31103133

31113134
describe('#workspaceIdSync', () => {

0 commit comments

Comments
 (0)