diff --git a/src/roktManager.ts b/src/roktManager.ts index 44fbe074d..2450e58ea 100644 --- a/src/roktManager.ts +++ b/src/roktManager.ts @@ -193,7 +193,8 @@ export default class RoktManager { const { attributes } = options; const sandboxValue = attributes?.sandbox || null; const mappedAttributes = this.mapPlacementAttributes(attributes, this.placementAttributesMapping); - + this.logger?.verbose(`mParticle.Rokt selectPlacements called with attributes:\n${JSON.stringify(attributes, null, 2)}`); + this.currentUser = this.identityService.getCurrentUser(); const currentUserIdentities = this.currentUser?.getUserIdentities()?.userIdentities || {}; diff --git a/test/jest/roktManager.spec.ts b/test/jest/roktManager.spec.ts index c37e6873b..23ab1cdf0 100644 --- a/test/jest/roktManager.spec.ts +++ b/test/jest/roktManager.spec.ts @@ -861,7 +861,6 @@ describe('RoktManager', () => { expect(mockCaptureTiming).toHaveBeenCalledWith(PerformanceMarkType.JointSdkSelectPlacements); expect(mockCaptureTiming).toHaveBeenCalledTimes(1); }); - it('should call kit.selectPlacements with empty attributes', () => { const kit: IRoktKit = { @@ -2332,6 +2331,49 @@ describe('RoktManager', () => { // Verify kit was called expect(kit.selectPlacements).toHaveBeenCalled(); }); + + it('should log developer passed attributes via verbose logger', async () => { + const kit: Partial = { + launcher: { + selectPlacements: jest.fn(), + hashAttributes: jest.fn(), + use: jest.fn(), + }, + hashAttributes: jest.fn(), + selectPlacements: jest.fn().mockResolvedValue({}), + setExtensionData: jest.fn(), + use: jest.fn(), + }; + + roktManager.kit = kit as IRoktKit; + + const mockIdentity = { + getCurrentUser: jest.fn().mockReturnValue({ + getUserIdentities: () => ({ + userIdentities: { + email: 'test@example.com' + } + }), + setUserAttributes: jest.fn() + }), + identify: jest.fn() + } as unknown as SDKIdentityApi; + + roktManager['identityService'] = mockIdentity; + + const options: IRoktSelectPlacementsOptions = { + attributes: { + email: 'test@example.com', + customAttr: 'value', + } + }; + + await roktManager.selectPlacements(options); + + expect(mockMPInstance.Logger.verbose).toHaveBeenCalledWith( + `mParticle.Rokt selectPlacements called with attributes:\n${JSON.stringify({ email: 'test@example.com', customAttr: 'value' }, null, 2)}` + ); + }); }); describe('#setExtensionData', () => {