Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/roktManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 || {};

Expand Down
44 changes: 43 additions & 1 deletion test/jest/roktManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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<IRoktKit> = {
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', () => {
Expand Down
Loading